Commit 0b6f675c authored by Gergely Ujvari's avatar Gergely Ujvari

Do not normalize searchfilter sent to the backend.

We have every analyzers setup for ES to do that more precisely.
parent 6eef7b3d
......@@ -43,14 +43,6 @@ class SearchFilter
tokens
# Converts a string into lowercase and asciifolds
this.$inject = ['stringHelpers']
constructor: (stringHelpers) ->
@_normalize = (str) ->
if typeof str is 'string'
return stringHelpers.unidecode(str.toLowerCase())
else return str
# This function will generate the facets from the search-text input
# It'll first tokenize it and then sorts them into facet lists
# The output will be a dict with the following structure:
......@@ -82,7 +74,7 @@ class SearchFilter
filter = term.slice 0, term.indexOf ":"
unless filter? then filter = ""
switch filter
when 'quote' then quote.push @_normalize term[6..]
when 'quote' then quote.push term[6..]
when 'result' then result.push term[7..]
when 'since'
# We'll turn this into seconds
......@@ -118,11 +110,11 @@ class SearchFilter
# Time given in year
t = /^(\d+)year$/.exec(time)[1]
since.push t * 60 * 60 * 24 * 365
when 'tag' then tag.push @_normalize term[4..]
when 'text' then text.push @_normalize term[5..]
when 'uri' then uri.push @_normalize term[4..]
when 'user' then user.push @_normalize term[5..]
else any.push @_normalize term
when 'tag' then tag.push term[4..]
when 'text' then text.push term[5..]
when 'uri' then uri.push term[4..]
when 'user' then user.push term[5..]
else any.push term
any:
terms: any
......
......@@ -507,6 +507,14 @@ class ViewFilter
limit = Math.min((filters.result?.terms or [])...)
count = 0
# Normalizing the filters, need to do only once.
for _, filter of filters
if filter.terms
filter.terms = filter.terms.map (e) =>
e = e.toLowerCase()
e = @_normalize e
e
for annotation in annotations
break if count >= limit
......
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