Commit d76e9f82 authored by Gergely Ujvari's avatar Gergely Ujvari

Fix tag search

ES stores the tag field as tags

Fix #1879
parent 0ddbfa3d
...@@ -46,6 +46,11 @@ class SearchFilter ...@@ -46,6 +46,11 @@ class SearchFilter
# Turns string query into object, where the properties are the search terms # Turns string query into object, where the properties are the search terms
toObject: (searchtext) -> toObject: (searchtext) ->
obj = {} obj = {}
filterToBackendFilter = (filter) ->
if filter is 'tag'
'tags'
else
filter
addToObj = (key, data) -> addToObj = (key, data) ->
if obj[key]? if obj[key]?
...@@ -60,7 +65,7 @@ class SearchFilter ...@@ -60,7 +65,7 @@ class SearchFilter
unless data unless data
filter = 'any' filter = 'any'
data = term data = term
addToObj(filter, data) addToObj(filterToBackendFilter(filter), data)
obj obj
# This function will generate the facets from the search-text input # This function will generate the facets from the search-text input
...@@ -228,7 +233,7 @@ class QueryParser ...@@ -228,7 +233,7 @@ class QueryParser
query_type: 'multi_match' query_type: 'multi_match'
match_type: 'cross_fields' match_type: 'cross_fields'
and_or: 'and' and_or: 'and'
fields: ['quote', 'tag', 'text', 'uri', 'user'] fields: ['quote', 'tags', 'text', 'uri', 'user']
populateFilter: (filter, query) => populateFilter: (filter, query) =>
# Populate a filter with a query object # Populate a filter with a query object
......
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