Configure the LWAI Neural Hybrid Search pipelineLucidworks AI
The LWAI Neural Hybrid Search pipeline is a default pipeline that contains all the required query stages to set up Neural Hybrid Search using Lucidworks AI.
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 Fusion 5.9.5 and later versions of Fusion 5.9. |
This pipeline uses the following stages:
Configure the pipeline
To add the Neural Hybrid Search (NHS) query pipeline:
-
Sign in to Fusion and click Querying > Query Pipelines.
-
Select the default LWAI-neural-hybrid-search-NHS pipeline.
-
Configure the following stages included in the default pipeline.
Text Tagger
The Text Tagger stage queries a Solr text tagger request handler to perform spell correction, phrase boosting, and synonym expansion.
-
In the Label field, enter a unique identifier for this stage or leave blank to use the default value.
-
In the Condition field, enter a script that results in true or false, which determines if the stage should process, or leave blank.
-
In the Tagger Collection field, enter where the tagger request is sent. The default is the query_rewrite collection for the application selected. You must enter a collection with only one shard because Text Tagger does not support multi-shard collections. Template expressions are supported.
-
In the Param to Tag field, enter a value of q, which is the name of the parameter in the request containing text to tag. This field is ignored on DSL requests.
-
In the Save Tags in Context field, enter the tags to save in context instead of applying directly to the incoming query in this stage. This enables downstream stages to apply the tags after completing other processing. This field is ignored on DSL requests.
-
Select the following checkboxes:
-
Spell Correction
-
Phrase Boosting
-
Synonym Expansion
-
Remove Words
-
Tail Rewrites
-
-
In the Filter Override field, enter your filter to override filtering for built-in tagger doc types.
-
In the Original Term Boost for Synonyms field, enter the boost to use for the original term during synonym expansion. For example, 2. To disable this function, enter -1.
-
In the Default Phrase Boost field, enter the boost to use as a default for phrases that do not have a boost value set. For example, 2. To disable this function, enter -1.
-
In the Default Phrase Slop field, enter the distance between the terms of the query while still considering it a phrase match. For example, 10.
-
In the Overlapping Tag Policy field, select the default value of longest_dominant_right to ensure the retained tags have no overlaps. The value is the algorithm that determines which tags in an overlapping set should be retained, versus being pruned away. On DSL requests, this field is ignored so the default value of longest_dominant_right is always used. The available options correspond to Solr Tagger Handler overlaps: all, no_sub, or longest_dominant_right. Setting the value to all or no_sub allows more rewrites to potentially be applied to a query, but can increase the chance of producing undesirable rewrites.
-
In the Additional Params to be included in the Text Tagger Request section, enter optional values you want to include.
-
In the Max Wait for Lookup (ms) field, enter the number of milliseconds to wait for the call to the remote tagger collection to return. For example, 500. To disable this function, enter -1.
-
In the Skip Query Regex field, enter the pattern that identifies queries that are skipped because they contain that pattern. For example, you may want to skip single term queries with wildcards.
-
Click Save.
Boost with Signals
The Boost with Signals stage uses aggregated signals to selectively boost items in the set of search results.
-
In the Label field, enter a unique identifier for this stage or leave blank to use the default value.
-
In the Condition field, enter a script that results in true or false, which determines if the stage should process, or leave blank.
-
Select the Asynchronous Execution Config check box to process this stage asynchronously.
-
In the Number of Recommendations field, enter the number of documents to return in the query. For example, 10.
-
In the Number of Signals field, enter the number of signals to process when getting recommended items. For example, 100.
-
In the Aggregation Type field, enter an applicable value. For example, click@doc_id,filters,query.
-
In the Solr Field to Boost On field, enter which Solr field to use when applying recommendation boosts. For example, id.
-
In the Boost Method field, select the boost method to use. If the defType!=edismax for the main query, select query-parser. Another example is query-param.
-
In the Boost Param field, select one of the following values:
-
boost to multiply scores by the boost values
-
bq to add optional clauses to main query
-
-
In the Solr Query parameters section, enter the following Parameter Name:Parameter Value entries:
-
qf: query_t
-
pf: query_t^50
-
pf: query_t-3^20
-
pf2: query_t^20
-
pf2: query_t~3^10
-
pf3: query_t^10
-
pf3: query_t~3^5
-
boost: map(query({!field f=query_s v=$q}),0,0,1,20)
-
mm: 50%
-
defType: edismax
-
sort: score desc, weight_d desc
-
fq: weight_d:[ TO ]
-
-
In the Rollup Field, enter the field name to use when rolling up documents that have the same doc id. For example, doc_id_s.
-
In the Rollup weight field, enter the field name to use for signal weights. For example, weight_d.
-
In the Rollup weight strategy field, select one of the following methods to use when rolling up the weight:
-
max
-
sum
-
-
In the Final Boost Weight Expression field, enter the optional expression to compute the final boost weight using a combination of fields returned by Solr. For example, score and weight_d. Set to weight_d for similar behavior as older versions. Another example is math:log(weight_d + 1) + 10 * math:log(score+1).
-
In the Document Weights Context Key field, enter the context key in which to save boosts for docId:weight_d.
-
In the Query Param field, enter the default value of q, which is the name of the parameter in the request containing query to boost.
-
Select the Include Enriched Query checkbox to:
-
Enable the stage to combine the user’s original query with the output of any stages that enrich the query, such as the Text Tagger stage.
-
Expand the recall of the boost lookup. However, precision may be impacted.
-
Enable the stage to change the configured mm parameter to accommodate additional terms added to the boost lookup query.
-
-
In the Update Policy field, select to replace or append the boost parameter in the final query.
-
Click Save.
Query Fields
The Query Fields stage configures query parameters for a Solr search.
-
In the Label field, enter a unique identifier for this stage or leave blank to use the default value.
-
In the Condition field, enter a script that results in true or false, which determines if the stage should process, or leave blank.
-
In the Number of Results field, enter the number of query fields to return. For example, 10.
-
In the Result Offset field, enter the value that designates the starting position of the first result from the beginning of the data being queried. Offset is zero-based, so a value of 9 counts from 0 through 9 and the first record returned is the 10th record discovered in the query.
-
In the Results Sort Order section, enter values for the following fields:
-
Sort Type. For example, sort on expression, field, query, or relevancy.
-
Field Name or Expression on which to sort.
-
Sort Order. Select either asc or desc.
-
-
In the Search Fields section, enter the field name and boost values to include in this stage.
-
In the Return Fields section, enter the field names to include in this stage.
-
Select the Return Score checkbox to set as true and determine if a score is determined for this stage.
-
In the Minimum Should Match field, enter the minimum string to match for this stage.
-
Select the Grouping Options checkbox to enter values in the following fields:
-
Grouping Field. The field name on which to group results.
-
Group Size. The number of results per group.
-
Group Sort. Enter values in the following fields:
-
Sort Type. For example, sort on expression, field, query, or relevancy.
-
Field Name or Expression on which to sort.
-
Sort Order. Select either asc or desc.
-
-
Group Leader Strategy. Select this checkbox to define selection criteria for the representative document from each group. Only one method may be used at a time. Defaults to relevancy if not specified. Values are:
-
By Field Value. If selected, include documents with the minimum or maximum value for the indicated field to be the representative document for each group.
-
By Sort. If selected, include the representative document for each group based on the order in which they are returned with the given sort criteria.
-
-
-
Click Save.
LWAI Vectorize Query
The LWAI Vectorize Query stage configures parameters to generate a vector by using a Lucidworks AI (LWAI) embedding model to encode the input to a vector representation. This stage is ignored if the input is blank or a wildcard of either an asterisk (*) or a colon (:) is used.
-
In the Label field, enter a unique identifier for this stage.
-
In the Condition field, enter a script that results in true or false, which determines if the stage should process.
-
In the Account Name field, select the name of the Lucidworks AI account.
If your account name does not appear in the list or you are unsure which one to select, check your Lucidworks AI Gateway configuration.
-
In the Model field, select the Lucidworks AI model to use for encoding.
If your model does not appear in the list or you are unsure which one to select, check your Lucidworks AI Gateway configuration.
For more information, see:
-
In the Query Input field, enter the location from which the query is retrieved.
-
In the Output context variable field, enter the name of the variable where the vector value from the response is saved.
-
In the Use Case Configuration section, click the + sign to enter the parameter name and value to send to Lucidworks AI. The
useCaseConfig
parameter that is common to embedding use cases isdataType
, but each use case may have other parameters. The value for the query stage isquery
. -
The Model Configuration section is not currently available.
-
Select the Fail on Error checkbox to generate an exception if an error occurs during this stage.
-
Click Save.
The Top K setting is set to 100 by default. We recommend leaving this as 100 or setting it to 200. |
This query stage must be placed before the Solr Query stage. For more information, see Reorder Query Pipeline Stages.
Hybrid Query
The Hybrid Query stage is a combination of semantic vector search and lexical search. This stage is ignored if the input is blank or a wildcard of either an asterisk (*) or a colon (:).
In addition, this stage does not function correctly if the incoming q parameter is a Solr query parser string. For example, field_t:foo rather than a raw user query string.
The resulting query is always written to <request.params.q>.
-
In the Label field, enter a unique identifier for this stage or leave blank to use the default value.
-
In the Condition field, enter a script that results in true or false, which determines if the stage should process, or leave blank.
-
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.
-
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.
-
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.
-
In the Vector Query Field, enter the name of the Solr field for k-nearest neighbor (KNN) vector search.
-
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. -
In the Vector Query Weight field, enter the relative weight of the vector query. For example, 0.7.
-
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.
-
If the Use KNN Query checkbox is selected, enter a value in the Number of Vector Results field. For example, 1000.
-
-
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.
-
-
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.
-
Click Save.
Apply Rules
The Apply Rules stage applies the rules configured in the collection to the query.
-
In the Label field, enter a unique identifier for this stage or leave blank to use the default value.
-
In the Condition field, enter a script that results in true or false, which determines if the stage should process, or leave blank.
-
Select the Asynchronous Execution Config check box to process this stage asynchronously.
-
In the Collection field, enter the name of the collection that contains the rules. If this field does not contain a value, the default rules collection for the selected application is used. Template expressions are supported.
-
In the Request Handler field, enter a value of select.
-
In the HTTP Method field, select POST.
-
In the Rule Triggering Limit field, enter the maximum number of business rules to be triggered by the query. The default rules matching limit is 100. This configuration overwrites the rows parameter set in Query Parameters section.
-
In the Query Parameters section, enter the names and values to use when querying the rules collection. If you set the rows parameter here, it will be overwritten by the configuration in the Rule Triggering Limit field.
-
In the Subquery Rewrite Pipeline id field, enter the value to call a Fusion query pipeline to modify the rule-retrieving subquery. Template expressions are supported.
-
In the Headers section, enter the names and values to use in this stage.
-
Select the Use Original Query If No Rules Match checkbox so the stage will try to match rules using the original query (un-tagged) sent into the Text Tagger stage, if available.
-
Select the Partially Matched Filter Queries Will Trigger the Rule checkbox so the stage will trigger filter rules as long as there is one filter query in the query parameter that matches the filter specified in the rule.
-
In the Max Wait for Lookup (ms), enter the number of milliseconds to wait for the the call to the remote tagger collection to return. For example, 500. To disable this function, enter -1.
-
Click Save.
Solr Query
The Solr Query stage sends the search request to Solr.
-
In the Label field, enter a unique identifier for this stage or leave blank to use the default value.
-
In the Condition field, enter a script that results in true or false, which determines if the stage should process, or leave blank.
-
In the Configure Request Handlers Allowed for Queries section, enter a value for the request handlers used in this stage.
-
In the HTTP Method field, select POST.
-
Select the Allow Federated Search checkbox to enable the use of Solr collection and shards parameters for this stage.
-
Select the Generate Response Signal checkbox to generate a response signal containing metadata about the response from Solr. Response signals are used by App Insights and experiments. This setting only applies if the searchLogs and signals features are enabled for the collection. To avoid generating response signals as Users type, do not select this option.
-
In the Exclude Response Signal Criteria section, enter query parameters and Regex patterns to prevent generating a response signal based on specific parameters in the query. For example, use these fields to enable response signals in general, but to disable for auto-complete queries.
-
In the Preferred Replica Type field, select pull to specify a replicate type that will be given a higher order of precedence when querying Solr. This preference will only be applied for queries that target multiple shards.
-
Click Save.
Modify Response with Rules
The Modify Response with Rules stage modifies the response from Solr using matching rules from the Apply Rules stage.
-
In the Label field, enter a unique identifier for this stage or leave blank to use the default value.
-
In the Condition field, enter a script that results in true or false, which determines if the stage should process, or leave blank.
-
In the Facet Field Label Blob ID, enter the ID for a blob containing labels for facet fields to add to the response.
-
In the Facet Label Parse Delimiter field, enter || as the delimiter to parse each facet label mapping in the blob. A Java regular expression is also a valid value. Regex must start with ^ and end with $.
-
Click Save.
Order the stages
For the pipeline to operate correctly, the stages must be in the following order:
When you have ordered the stages, click Save.