Product Selector

Fusion 5.12
    Fusion 5.12

    Configure Neural Hybrid Search

    Neural Hybrid Search combines lexical-semantic search with dense vector search.

    This feature is currently only available to clients who have contracted with Lucidworks for features related to Neural Hybrid Search and Lucidworks AI.

    This feature is only available in Managed Fusion 5.9.5.

    Lucidworks recommends setting up Neural Hybrid Search with Lucidworks AI vector search, however you can instead use Seldon vector search. If using Lucidworks AI, you may use the default LWAI Neural Hybrid Search pipeline.

    Modify Solr managed-schema

    This step is required if you’re migrating a collection from a version of Managed Fusion that does not support Neural Hybrid Search. If creating a new collection in Managed Fusion 5.9.5, you can continue to Configure Hybrid Query stage.

    1. Go to System > Solr Config then click managed-schema to edit it.

    2. Comment out <copyField dest="_text_" source="*"/> and add <copyField dest="text" source="*_t"/> below it. This will concatenate and index all *_t fields.

    3. Add the following code block to the managed-schema file:

      <fieldType class="solr.DenseVectorField" hnswBeamWidth=“200"
          hnswMaxConnections="45” name="knn_DIM_vector" similarityFunction="cosine"
          vectorDimension="DIM"/>
      <dynamicField docValues="false" indexed="true" multiValued="false" name="*_512v"
            required="false" stored="true" type="knn_DIM_vector"/>
      This example uses 512 vector dimension. If your model uses a different dimension, modify the code block to match your model. For example, _1024v. There is no limitation on supported vector dimensions.

    Configure Hybrid Query stage

    1. In the same query pipeline where you configured vector search, click Add a new pipeline stage, then select Hybrid Query.

    2. In the Label field, enter a unique identifier for this stage or leave blank to use the default value.

    3. In the Condition field, enter a script that results in true or false, which determines if the stage should process, or leave blank.

    4. In the Lexical Query Input field, enter the location from which the lexical query is retrieved. For example, <request.params.q>. Template expressions are supported.

    5. In the Lexical Query Weight field, enter the relative weight of the lexical query. For example, 0.3. If this value is 0, no re-ranking will be applied using the lexical query scores.

    6. In the Number of Lexical Results field, enter the number of lexical search results to include in re-ranking. For example, 1000. A value is 0 is ignored.

    7. In the Vector Query Field, enter the name of the Solr field for k-nearest neighbor (KNN) vector search.

    8. In the Vector Input field, enter the location from which the vector is retrieved. Template expressions are supported. For example, a value of <ctx.vector> evaluates the context variable resulting from a previous stage, such as the LWAI Vectorize Query stage.

    9. In the Vector Query Weight field, enter the relative weight of the vector query. For example, 0.7.

    10. Select the Use KNN Query checkbox to use the knn query parser and configure its options. This option cannot be selected if Use VecSim Query checkbox is selected. In addition, Use KNN Query is used if neither Use KNN Query or Use VecSim Query is selected.

      1. If the Use KNN Query checkbox is selected, enter a value in the Number of Vector Results field. For example, 1000.

    11. Select the Use VecSim Query checkbox to use the vecSim query parser and configure its options. This option cannot be selected if Use KNN Query checkbox is selected.

      If the Use VecSim Query checkbox is selected, enter values in the following fields:

      • Min Return Vector Similarity. Enter the minimum vector similarity value to qualify as a match from the Vector portion of the hybrid query.

      • Min Traversal Vector Similarity. Enter the minimum vector similarity value to use when walking through the graph during the Vector portion of the hybrid query. The value must be lower than, or equal to, the value in the Min Return Vector Similarity field.

    12. In the Minimum Vector Similarity Filter, enter the value for a minimum similarity threshold for filtering documents. This option applies to all documents, regardless of other score boosting such as rules or signals.

    13. Click Save.

    Make sure the Hybrid Query stage is ordered before the Solr Query stage. See Reorder Query Pipeline Stages.

    Perform hybrid searches

    After setting up the stages, you can perform hybrid searches via the knn query parser as you would with Solr. Specify the search vector and include it in the query. For example, change the q parameter to a knn query parser string.

    The Hybrid Query stage will encode user queries using the specified model and modify the q parameter to use the knn query parser, turning the query into a vector search.

    XDenseVectorField is not supported in Managed Fusion 5.9.5. Instead, use DenseVectorField.

    Known issues

    Neural Hybrid Search is not recommended for high availability (HA) deployments because it may cause errors. A workaround for HA deployments is to add an Additional Query Parameters stage with the following settings:

    Parameter Name Parameter Value Update Policy

    debug

    true

    remove

    debugQuery

    true

    remove

    Save the stage and order it after the Hybrid Query stage but before the Solr Query stage.