Commit b351d61f authored by Gergely Ujvari's avatar Gergely Ujvari

Get rid of the exact_match configuration parameter

As now we only use it with a false parameter every time,
it is no longer serving any purpose
parent d06f47e1
...@@ -146,7 +146,6 @@ class SearchFilter ...@@ -146,7 +146,6 @@ class SearchFilter
# { facet_name : { # { facet_name : {
# formatter: to format the value (optional) # formatter: to format the value (optional)
# path: json path mapping to the annotation field # path: json path mapping to the annotation field
# exact_match: true|false (default: true)
# case_sensitive: true|false (default: false) # case_sensitive: true|false (default: false)
# and_or: and|or for multiple values should it threat them as 'or' or 'and' (def: or) # and_or: and|or for multiple values should it threat them as 'or' or 'and' (def: or)
# operator: if given it'll use this operator regardless of other circumstances # operator: if given it'll use this operator regardless of other circumstances
...@@ -165,29 +164,24 @@ class QueryParser ...@@ -165,29 +164,24 @@ class QueryParser
rules: rules:
user: user:
path: '/user' path: '/user'
exact_match: false
case_sensitive: false case_sensitive: false
and_or: 'or' and_or: 'or'
text: text:
path: '/text' path: '/text'
exact_match: false
case_sensitive: false case_sensitive: false
and_or: 'and' and_or: 'and'
tag: tag:
path: '/tags' path: '/tags'
exact_match: false
case_sensitive: false case_sensitive: false
and_or: 'and' and_or: 'and'
quote: quote:
path: '/quote' path: '/quote'
exact_match: false
case_sensitive: false case_sensitive: false
and_or: 'and' and_or: 'and'
uri: uri:
formatter: (uri) -> formatter: (uri) ->
uri.toLowerCase() uri.toLowerCase()
path: '/uri' path: '/uri'
exact_match: false
case_sensitive: false case_sensitive: false
and_or: 'or' and_or: 'or'
options: options:
...@@ -209,12 +203,10 @@ class QueryParser ...@@ -209,12 +203,10 @@ class QueryParser
when '1 year' then 365*24*60*60 when '1 year' then 365*24*60*60
new Date(new Date().valueOf() - seconds*1000) new Date(new Date().valueOf() - seconds*1000)
path: '/created' path: '/created'
exact_match: false
case_sensitive: true case_sensitive: true
and_or: 'and' and_or: 'and'
operator: 'ge' operator: 'ge'
any: any:
exact_match: false
case_sensitive: false case_sensitive: false
and_or: 'and' and_or: 'and'
path: ['/quote', '/tags', '/text', '/uri', '/user'] path: ['/quote', '/tags', '/text', '/uri', '/user']
...@@ -235,15 +227,12 @@ class QueryParser ...@@ -235,15 +227,12 @@ class QueryParser
# Now generate the clause with the help of the rule # Now generate the clause with the help of the rule
exact_match = if rule.exact_match? then rule.exact_match else true
case_sensitive = if rule.case_sensitive? then rule.case_sensitive else false case_sensitive = if rule.case_sensitive? then rule.case_sensitive else false
and_or = if rule.and_or? then rule.and_or else 'or' and_or = if rule.and_or? then rule.and_or else 'or'
mapped_field = if rule.path? then rule.path else '/'+category mapped_field = if rule.path? then rule.path else '/'+category
if and_or is 'or' if and_or is 'or'
oper_part = oper_part = if rule.operator? then rule.operator else 'match_of'
if rule.operator? then rule.operator
else if exact_match then 'one_of' else 'match_of'
value_part = [] value_part = []
for term in terms for term in terms
...@@ -252,9 +241,7 @@ class QueryParser ...@@ -252,9 +241,7 @@ class QueryParser
filter.addClause mapped_field, oper_part, value_part, case_sensitive, rule.options filter.addClause mapped_field, oper_part, value_part, case_sensitive, rule.options
else else
oper_part = oper_part = if rule.operator? then rule.operator else 'matches'
if rule.operator? then rule.operator
else if exact_match then 'equals' else 'matches'
for val in terms for val in terms
value_part = if rule.formatter then rule.formatter val else val value_part = if rule.formatter then rule.formatter val else val
filter.addClause mapped_field, oper_part, value_part, case_sensitive, rule.options filter.addClause mapped_field, oper_part, value_part, case_sensitive, rule.options
......
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