Class: Workarea::Search::CategoryBrowse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Pagination
#each_by, #from, #page, #per_page, #results, #size
#active_for_segments_clause, #displayable_when_out_of_stock_sort_clause, #inventory_display_clause, #preview_current_release_clause, #product_display_query_clauses
#category_filters, #category_ids, #category_query_clauses
#load_inventory_from, #load_model_from, #load_pricing_from
Methods included from Facets
#facets, #range_facets, #terms_facets
Methods included from Query
#additional_options, #body, #id, #initialize, #load_model_from, #loaded_results, #query_string, #response, #results, #scroll, #stats, #total
Class Method Details
.available_sorts ⇒ Object
Instance Method Details
#aggregations ⇒ Object
31
32
33
|
# File 'app/queries/workarea/search/category_browse.rb', line 31
def aggregations
facets.map(&:aggregation).reduce(&:merge)
end
|
#category_id ⇒ Object
54
55
56
57
58
|
# File 'app/queries/workarea/search/category_browse.rb', line 54
def category_id
if params[:category_ids].respond_to?(:first)
params[:category_ids].first
end
end
|
#post_filter ⇒ Object
35
36
37
38
39
40
41
|
# File 'app/queries/workarea/search/category_browse.rb', line 35
def post_filter
{
bool: {
must: facets.map(&:post_filter_clause).reject(&:blank?)
}
}
end
|
#query ⇒ Object
23
24
25
26
27
28
29
|
# File 'app/queries/workarea/search/category_browse.rb', line 23
def query
{
bool: {
must: product_display_query_clauses + category_query_clauses
}
}
end
|
#sort ⇒ Object
43
44
45
46
47
48
|
# File 'app/queries/workarea/search/category_browse.rb', line 43
def sort
result = current_sort_clauses
add_displayable_out_of_stock_sort_clause(result)
result << views_score_sort_clause
result
end
|
#sorts ⇒ Object
50
51
52
|
# File 'app/queries/workarea/search/category_browse.rb', line 50
def sorts
Array(params[:sort])
end
|