Commit c3fa0e50 authored by Ujvari Gergely's avatar Ujvari Gergely

Introducing ES query_string query for URI retrieval

- For stream and search the uri search will be done with query_string.
- Using latest annotator-store commit.
parent ba16b1c6
......@@ -156,12 +156,13 @@ class StreamFilter
@filter.clauses.push clause
this
addClause: (field, operator, value, case_sensitive = false) ->
addClause: (field, operator, value, case_sensitive = false, es_query_string = false) ->
@filter.clauses.push
field: field
operator: operator
value: value
case_sensitive: case_sensitive
es_query_string: es_query_string
this
setClausesParse: (clauses_to_parse, error_checking = false) ->
......
......@@ -54,13 +54,14 @@ class SearchHelper
case_sensitive = if rule.case_sensitive? then rule.case_sensitive else false
and_or = if rule.and_or? then rule.and_or else 'or'
mapped_field = if rule.path? then rule.path else '/'+category
es_query_string = if rule.es_query_string? then rule.es_query_string else false
if values.length is 1
oper_part =
if rule.operator? then rule.operator
else if exact_match then 'equals' else 'matches'
value_part = if rule.formatter then rule.formatter values[0] else values[0]
filter.addClause mapped_field, oper_part, value_part, case_sensitive
filter.addClause mapped_field, oper_part, value_part, case_sensitive, es_query_string
else
if and_or is 'or'
val_list = ''
......@@ -72,14 +73,14 @@ class SearchHelper
oper_part =
if rule.operator? then rule.operator
else if exact_match then 'one_of' else 'match_of'
filter.addClause mapped_field, oper_part, val_list, case_sensitive
filter.addClause mapped_field, oper_part, val_list, case_sensitive, es_query_string
else
oper_part =
if rule.operator? then rule.operator
else if exact_match then 'equals' else 'matches'
for val in values
value_part = if rule.formatter then rule.formatter val else val
filter.addClause mapped_field, oper_part, value_part, case_sensitive
filter.addClause mapped_field, oper_part, value_part, case_sensitive, es_query_string
if limit != 50 then categories['results'] = [limit]
[filter.getFilter(), categories]
......@@ -119,6 +120,7 @@ class StreamSearch
path: '/uri'
exact_match: false
case_sensitive: false
es_query_string: true
and_or: 'or'
since:
formatter: (past) ->
......
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