Convert a Query to a Vector Query
This section describes how to use QMS to convert a conceptual (text) query into a vector search before QMS sends the query to the IDOL Content component.
Configure Vector Fields
To convert queries to vector queries, you must configure vector fields in QMS to define the Content fields that contain vector values in your index.
To configure a vector field
-
Open your configuration file in a text editor.
-
Find the
[VectorFields]
configuration section, or create one if it does not exist. -
Add a new zero-based index parameter to define a new vector field configuration. For example:
[VectorFields]
0=MyVectorA
1=MyVectorB -
Create a new configuration section with the name that you defined.
-
In this new configuration section, set the following parameters:
-
FieldName. The name of the field in the IDOL Content component index that contains the vector values that you want to query with this vector field configuration.
-
Model. The name of the QMS configuration section that contains the embedding generation details for this vector configuration. This embedding model must generate vectors that are compatible with the values in the Content field for this configuration. For more information about embedding configuration, see Configure Embeddings in QMS.
You can also set the optional parameters MaxDistance and MaxNeighbors.
-
-
Save and close the configuration file.
For example:
[VectorFields] 0=MyVectorA 1=MyVectorB [MyVectorA] FieldName=VECTORA Model=SentenceTransformer [MyVectorB] FieldName=VECTORB Model=SentenceTransformer MaxDistance=5 MaxNeighbors=3
Convert a Query to a Vector Query
You convert a query to a vector query by setting the VectorConfig action parameter on your Query
to QMS. You can also use the QueryType parameter to include a vector query with a conceptual query.
For example:
action=Query&Text=The quick brown fox jumps over the lazy dog&VectorConfig=MyVectorA&QueryType=conceptual,vector
QMS converts the query text to an embedding and sends a query of the following form to Content:
(The quick brown fox jumps over the lazy dog) OR VECTOR{embeddingdata}:VECTORA
where VECTORA
is the field configured in the [MyVectorA]
configuration, and embeddingdata
is the embedding for the query text, generated by the model configured in the [MyVectorA]
configuration.
You can include multiple vector field configurations by using a comma-separated list. For example:
action=Query&Text=Cat&VectorConfig=MyVectorA,MyVectorB
QMS converts the query text to embeddings for both vector configurations, and sends a query of the following form to Content:
VECTOR{embeddingdataA}:VECTORA OR VECTOR{embeddingdataB}:VECTORB
QMS converts the query text to vectors before it processes any other manipulations (such as query cooking or synonym expansion).
For more information about vector search, refer to the IDOL Content component Help.