Skip to main content
The Neural Hybrid Query stage performs hybrid lexical-semantic search that combines BM25-type lexical search with KNN dense vector search via Solr. Lucidworks Search automatically switches to lexical-only search if vectorization is unavailable to ensure uninterrupted results.
  • If no vector is produced, you will see the message: Input vector value is blank, skipping vector processing.
  • If a vector exists but is empty, you will see the message: Input vector value is empty, {}, skipping vector processing.
Not sure which hybrid query stage is right for you? Read about the differences between the hybrid query stages.
This feature is available starting in Lucidworks Search 5.9.10 and in all subsequent Lucidworks Search 5.9 releases.Access to the preFilterKey context property and the VectorPreFilter helper class are only available in 5.9.13 and later.

Prefiltering

Prefiltering is a technique that can improve performance and accuracy by filtering documents before applying the algorithm, reducing the number of documents that need to be processed. This is especially effective with the KNN algorithm. Prefiltering is disabled by default. To enable it, uncheck Block pre-filtering in this stage. When prefiltering is enabled, you can configure the filters using one or both of these methods:
  • Security filters
    You can use security filters as prefilters by placing the Graph Security Trimming Stage after this one in the pipeline.
    Then Lucidworks Search uses the security trimming filter as a prefilter.
  • JavaScript
    When prefiltering is enabled, this stage adds a preFilterKey object to the Javascript ctx object.
    You can place a Javascript stage after this one and use it to access the preFilterKey object, as in this example:
    You can also use the following example in Lucidworks Search 5.9.13 and later for placing pre-filter specific filters:
    The context object of the VectorPreFilter class is not present in Lucidworks Search 5.9.12 and earlier. Use the Additional Query Parameters stage example and the 5.9.12 note below.
    In Lucidworks Search 5.9.12 and earlier, a non-JavaScript approach is required in addition to the Additional Query Parameters stage example in the next section. In Lucidworks Search 5.9.12 the parameter vec_sim_q after the Neural Hybrid Query stage must be altered to include {!knn f=$vec_field v=$vec_q topK=100 preFilter=$vectorPreFilter} where topK is consistent with what your stage sets.
  • Additional Query Parameters stage If you do not want to create a JavaScript stage, you can create additional query parameters to prefilter the documents to be processed by using what the previous JavaScript example adds to the request. This step is required for Lucidworks Search 5.9.12 and earlier. The following example uses a single prefilter:
    The following example uses multiple prefilters:

Configuration

When entering configuration values in the UI, use unescaped characters, such as \t for the tab character. When entering configuration values in the API, use escaped characters, such as \\t for the tab character.