Skip to content

Different kinds of search

There are two opinionated, prebuild search strategies. You can overwrite retrieval with a closure if you want more customization. There is also some work being done on a custom strategy, which takes the query builder from a storage provider, but this has not been implemented yet for all.

Similarity Single Embedding

This is the default strategy.

Similarity single embedding does a vector similarity search. The strategy expects the query to have an embedding set.

Search with different kinds of search in the same database, automatically rerank if supported, and return the top matching documents.

For Qdrant, the strategy expects both a dense and a sparse vector to be present. Sparse vectors can be generated with integrations::fastembed::FastEmbed.

Additional configuration is also possible on the strategy itself.

Creating a pipeline with a strategy

To create a query pipeline from a search strategy, you can use the query::Pipeline::from_search_strategy constructor, like this:

let query_pipeline = query::Pipeline::from_search_strategy(
HybridSearch::default()
.with_top_n(20)
.with_top_k(20)
.to_owned(),
)