Commit 7694e136 by Hoang Phuc Do

Refactor code

parent 49c4ea61
class ProductFilter class ProductFilter
def filter_product_title(title) def self.filter_product_title(title)
title.blank? ? 'title:*' : "title:#{RSolr.solr_escape(title)}" title.blank? ? 'title:*' : "title:#{RSolr.solr_escape(title)}"
end end
def filter_suggest_keyword(keyword) def self.filter_suggest_keyword(keyword)
RSolr.solr_escape(keyword) RSolr.solr_escape(keyword)
end end
end end
\ No newline at end of file
...@@ -5,7 +5,8 @@ class Search ...@@ -5,7 +5,8 @@ class Search
# Get matched products with keyword # Get matched products with keyword
def products(search_query) def products(search_query)
matched_products(ProductFilter.filter_product_title(search_query)) @products_indexes = @solr.exec_select_request(ProductFilter.filter_product_title(search_query))
matched_products(@products_indexes)
end end
# Get suggested keywords # Get suggested keywords
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment