CouchbaseSearchVectorStore
you first need to install the langchain-couchbase
partner package:
text_key
and embedding_key
fields.
add_documents
function.
similarity_search_with_score
method.
filter
can be any valid SearchQuery supported by the Couchbase Python SDK. These filters are applied before the Vector Search is performed.
If you want to filter on one of the fields in the metadata, you need to specify it using .
For example, to fetch the source
field in the metadata, you need to specify metadata.source
.
Note that the filter needs to be supported by the Search Index.
fields
parameter in the searches. These fields are returned as part of the metadata
object in the returned Document. You can fetch any field that is stored in the Search index. The text_key
of the document is returned as part of the document’s page_content
.
If you do not specify any fields to be fetched, all the fields stored in the index are returned.
If you want to fetch one of the fields in the metadata, you need to specify it using .
For example, to fetch the source
field in the metadata, you need to specify metadata.source
.
metadata
object.
The results will be based on the combination of the results from both Vector Search and the searches supported by Search Service. The scores of each of the component searches are added up to get the total score of the result.
To perform hybrid searches, there is an optional parameter, search_options
that can be passed to all the similarity searches.search_options
can be found here.
date
between 2010 & 2020, rating
between 1 & 5 and author
set to either John Doe or Jane Doe.
metadata
object.
metadata.date
.
metadata.rating
.
filter
parameter instead of hybrid search.
search_options
parameter. Please refer to the documentation for more details on the available query methods and their syntax.
CouchbaseSearchVectoreStore
object.
metadata
field in the document not being indexed and/or stored by the Couchbase Search index. In order to index the metadata
field in the document, you need to add it to the index as a child mapping.
If you select to map all the fields in the mapping, you will be able to search by all metadata fields. Alternatively, to optimize the index, you can select the specific fields inside metadata
object to be indexed. You can refer to the docs to learn more about indexing child mappings.
Creating Child Mappings
CouchbaseSearchVectorStore
features and configurations head to the API reference