Package com.redis.vl.query
Class HybridQuery.HybridQueryBuilder
java.lang.Object
com.redis.vl.query.HybridQuery.HybridQueryBuilder
- Enclosing class:
HybridQuery
Builder for creating HybridQuery instances with fluent API.
-
Method Summary
Modifier and TypeMethodDescriptionalpha
(float alpha) Set the weight for combining text and vector scores.build()
Build the HybridQuery instance.dialect
(int dialect) Set the query dialect version.Set the data type for vector storage.filterExpression
(Filter filterExpression) Set an additional filter expression for the query.numResults
(int numResults) Set the maximum number of results to return.returnFields
(List<String> returnFields) Set the fields to return in results.Set custom stopwords for text search.Set the text query string.textFieldName
(String textFieldName) Set the name of the text field to search.textScorer
(String textScorer) Set the scoring algorithm for text search.vector
(float[] vector) Set the query vector for similarity search.vectorFieldName
(String vectorFieldName) Set the name of the vector field to search.
-
Method Details
-
text
Set the text query string.- Parameters:
text
- The text to search for- Returns:
- This builder for chaining
-
textFieldName
Set the name of the text field to search.- Parameters:
textFieldName
- The field name containing text data- Returns:
- This builder for chaining
-
vector
Set the query vector for similarity search. Makes a defensive copy.- Parameters:
vector
- The embedding vector to search with- Returns:
- This builder for chaining
-
vectorFieldName
Set the name of the vector field to search.- Parameters:
vectorFieldName
- The field name containing vector data- Returns:
- This builder for chaining
-
textScorer
Set the scoring algorithm for text search.- Parameters:
textScorer
- The text scorer (e.g., "BM25", "TFIDF")- Returns:
- This builder for chaining
-
filterExpression
Set an additional filter expression for the query.- Parameters:
filterExpression
- The filter to apply- Returns:
- This builder for chaining
-
alpha
Set the weight for combining text and vector scores.- Parameters:
alpha
- Weight between 0.0 (vector only) and 1.0 (text only), default 0.7- Returns:
- This builder for chaining
-
dtype
Set the data type for vector storage.- Parameters:
dtype
- The data type (e.g., "float32", "float64")- Returns:
- This builder for chaining
-
numResults
Set the maximum number of results to return.- Parameters:
numResults
- The result limit- Returns:
- This builder for chaining
-
returnFields
Set the fields to return in results. Makes a defensive copy.- Parameters:
returnFields
- List of field names to return- Returns:
- This builder for chaining
-
stopwords
Set custom stopwords for text search. Makes a defensive copy.- Parameters:
stopwords
- Set of words to exclude from text search- Returns:
- This builder for chaining
-
dialect
Set the query dialect version.- Parameters:
dialect
- The dialect version (default 2)- Returns:
- This builder for chaining
-
build
Build the HybridQuery instance.- Returns:
- The configured HybridQuery
- Throws:
IllegalArgumentException
- if required fields are missing or invalid
-