Class: Couchbase::SearchRequest
- Inherits:
-
Object
- Object
- Couchbase::SearchRequest
- Defined in:
- lib/couchbase/search_options.rb
Instance Method Summary collapse
-
#initialize(search) ⇒ SearchRequest
constructor
Creates a search request, used to perform operations against the Full Text Search (FTS) Couchbase service.
-
#search_query(query) ⇒ SearchRequest
Can be used to run a
SearchQuery
together with an existingVectorSearch
Note that a maximum of oneSearchQuery
can be provided. -
#vector_search(query) ⇒ SearchRequest
Can be used to run a
VectorSearch
together with an existingSearchQuery
Note that a maximum of oneVectorSearch
can be provided.
Constructor Details
#new(search_query) ⇒ SearchRequest #new(vector_search) ⇒ SearchRequest
Creates a search request, used to perform operations against the Full Text Search (FTS) Couchbase service.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/couchbase/search_options.rb', line 30 def initialize(search) case search when SearchQuery @search_query = search when VectorSearch @vector_search = search else raise Error::InvalidArgument, "Search type must be either SearchQuery or VectorSearch, #{search.class} given" end end |
Instance Method Details
#search_query(query) ⇒ SearchRequest
Can be used to run a SearchQuery
together with an existing VectorSearch
Note that a maximum of one SearchQuery
can be provided.
47 48 49 50 51 52 |
# File 'lib/couchbase/search_options.rb', line 47 def search_query(query) raise Error::InvalidArgument, "A SearchQuery has already been specified" unless @search_query.nil? @search_query = query self end |
#vector_search(query) ⇒ SearchRequest
Can be used to run a VectorSearch
together with an existing SearchQuery
Note that a maximum of one VectorSearch
can be provided.
62 63 64 65 66 67 |
# File 'lib/couchbase/search_options.rb', line 62 def vector_search(query) raise Error::InvalidArgument, "A VectorSearch has already been specified" unless @vector_search.nil? @vector_search = query self end |