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