lib/agnostic_backend/queryable/cloudsearch/executor.rb in agnostic_backend-0.9.9 vs lib/agnostic_backend/queryable/cloudsearch/executor.rb in agnostic_backend-1.0.0

- old
+ new

@@ -14,15 +14,17 @@ end def to_s result = '' result += "search?q=#{query_expression}" if query_expression + result += " filter=#{filter_query}" if filter_query result += " return=#{return_expression}" if return_expression result += " sort=#{sort}" if sort result += " size=#{size}" if size result += " offset=#{start}" if start result += " cursor=#{scroll_cursor}" if scroll_cursor + result += " parser=#{query_parser}" result end def params { @@ -42,15 +44,20 @@ } end private + def filter_visitor + options[:filter_visitor] + end + def client query.context.index.cloudsearch_domain_client end def filter_query + filter_expression.accept(filter_visitor) if filter_expression end def query_expression where_expression ? where_expression.accept(visitor) : 'matchall' end @@ -78,10 +85,15 @@ def query_options end def query_parser - 'structured' + case visitor + when SimpleVisitor + 'simple' + else + 'structured' + end end def return_expression select_expression.accept(visitor) if select_expression end \ No newline at end of file