Performing hybrid queries
Hybrid queries are VSS queries mixed with ordinary search algorithms (numeric, text, tag, and geo). When running hybrid queries with VSS, it is possible to include business logic in the query to enrich the search criteria and simplify the client application code. These conventional filters are pre-filters to the vector search operation and are meant to simplify the similarity search by reducing the computational effort to retrieve the KNN results. An example based on the previous proof of concept can be written by replacing * with the desired query. In this case, this is a filter with the genre tag that retrieves the closest documents in the “technical” category:
q = Query("@genre:{technical}=>[KNN 2 @embedding $vec AS score]") .return_field("score") ...