Class: Couchbase::Protostellar::RequestGenerator::Search Private
- Inherits:
-
Object
- Object
- Couchbase::Protostellar::RequestGenerator::Search
- Defined in:
- lib/couchbase/protostellar/request_generator/search.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- HIGHLIGHT_STYLE_MAP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ :html => :HIGHLIGHT_STYLE_HTML, :ansi => :HIGHLIGHT_STYLE_ANSI, nil => :HIGHLIGHT_STYLE_DEFAULT, }.freeze
- MATCH_QUERY_OPERATOR_MAP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ :or => :OPERATOR_OR, :and => :OPERATOR_AND, }.freeze
- SCAN_CONSISTENCY_MAP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ :not_bounded => :SCAN_CONSISTENCY_NOT_BOUNDED, }.freeze
- DEFAULT_LIMIT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
10
- DEFAULT_SKIP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
0
Instance Method Summary collapse
Instance Method Details
#search_query_request(index_name, query, options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/couchbase/protostellar/request_generator/search.rb', line 46 def search_query_request(index_name, query, ) proto_opts = { scan_consistency: SCAN_CONSISTENCY_MAP[.scan_consistency], include_explanation: .explain, highlight_style: HIGHLIGHT_STYLE_MAP[.highlight_style], disable_scoring: .disable_scoring, include_locations: .include_locations, } proto_opts[:highlight_fields] = .highlight_fields unless .highlight_fields.nil? proto_opts[:fields] = .fields unless .fields.nil? proto_opts[:sort] = get_sort() unless .sort.nil? proto_opts[:limit] = .limit || DEFAULT_LIMIT proto_opts[:skip] = .skip || DEFAULT_SKIP proto_opts[:collections] = .collections unless .collections.nil? proto_req = Generated::Search::V1::SearchQueryRequest.new( query: create_query(query), index_name: index_name, **proto_opts ) # Set the search facets in the request get_facets().each do |key, facet| proto_req.facets[key] = facet end create_search_request(proto_req, :search_query, ) end |