Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
dhp-venshop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hoang Phuc Do
dhp-venshop
Commits
7694e136
Commit
7694e136
authored
Jun 23, 2017
by
Hoang Phuc Do
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor code
parent
49c4ea61
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
app/services/product_filter.rb
+3
-2
app/services/search.rb
+2
-1
No files found.
app/services/product_filter.rb
View file @
7694e136
class
ProductFilter
def
filter_product_title
(
title
)
def
self
.
filter_product_title
(
title
)
title
.
blank?
?
'title:*'
:
"title:
#{
RSolr
.
solr_escape
(
title
)
}
"
end
def
filter_suggest_keyword
(
keyword
)
def
self
.
filter_suggest_keyword
(
keyword
)
RSolr
.
solr_escape
(
keyword
)
end
end
\ No newline at end of file
app/services/search.rb
View file @
7694e136
...
...
@@ -5,7 +5,8 @@ class Search
# Get matched products with keyword
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
# Get suggested keywords
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment