Module: Card::Set::Abstract::Search::Views::JsonFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/views.rb
Instance Method Summary collapse
-
#complete_or_match_search(limit: AUTOCOMPLETE_LIMIT, start_only: false, additional_cql: {}) ⇒ Object
-
#complete_search(limit: AUTOCOMPLETE_LIMIT, additional_cql: {}) ⇒ Object
-
#match_search(limit: AUTOCOMPLETE_LIMIT, not_names: [], additional_cql: {}) ⇒ Object
-
#view: molecule ⇒ Object
NOCACHE because paging_urls is uncacheable hash and thus not safe to merge.
-
#view: name_complete ⇒ Object
TODO: design better autocomplete API.
-
#view: name_match ⇒ Object
Instance Method Details
#complete_or_match_search(limit: AUTOCOMPLETE_LIMIT, start_only: false, additional_cql: {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/views.rb', line 53 def complete_or_match_search limit: AUTOCOMPLETE_LIMIT, start_only: false, additional_cql: {} starts_with = complete_search limit: limit, additional_cql: additional_cql return starts_with if start_only remaining_slots = limit - starts_with.size return starts_with if remaining_slots.zero? starts_with + match_search(not_names: starts_with, limit: remaining_slots, additional_cql: additional_cql) end |
#complete_search(limit: AUTOCOMPLETE_LIMIT, additional_cql: {}) ⇒ Object
65 66 67 |
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/views.rb', line 65 def complete_search limit: AUTOCOMPLETE_LIMIT, additional_cql: {} card.search name_cql(limit).merge(complete_cql).merge(additional_cql) end |
#match_search(limit: AUTOCOMPLETE_LIMIT, not_names: [], additional_cql: {}) ⇒ Object
69 70 71 72 73 |
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/views.rb', line 69 def match_search limit: AUTOCOMPLETE_LIMIT, not_names: [], additional_cql: {} return [] unless term_param.present? card.search name_cql(limit).merge(match_cql(not_names)).merge(additional_cql) end |
#view: molecule ⇒ Object
NOCACHE because paging_urls is uncacheable hash and thus not safe to merge
40 41 42 |
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/views.rb', line 40 view :molecule, cache: :never do molecule.merge render_paging_urls end |
#view: name_complete ⇒ Object
TODO: design better autocomplete API
45 46 47 |
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/views.rb', line 45 view :name_complete, cache: :never do format_json_search { complete_search limit: AUTOCOMPLETE_LIMIT } end |
#view: name_match ⇒ Object
49 50 51 |
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/views.rb', line 49 view :name_match, cache: :never do format_json_search { complete_or_match_search limit: AUTOCOMPLETE_LIMIT } end |