Package com.redis.vl.query
Class VectorRangeQuery.Builder
java.lang.Object
com.redis.vl.query.VectorRangeQuery.Builder
- Enclosing class:
VectorRangeQuery
Builder for creating VectorRangeQuery instances.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the VectorRangeQuery instance.distanceThreshold(double threshold) Set the distance threshold for range filtering.epsilon(double epsilon) Set the epsilon value for approximate HNSW search.Set the vector field name to search.inOrder(boolean inOrder) Set whether query terms must appear in order.k(int k) Deprecated.Use numResults() insteadnormalizeVectorDistance(boolean normalize) Set whether to normalize vector distances.numResults(int numResults) Set the maximum number of results to return.returnFields(String... fields) Set the fields to return in results (varargs).returnFields(List<String> fields) Set the fields to return in results (list).returnScore(boolean returnScore) Set whether to return scores with results.searchBufferCapacity(Integer searchBufferCapacity) Set the search buffer capacity parameter for SVS-VAMANA algorithm.searchWindowSize(Integer searchWindowSize) Set the search window size parameter for SVS-VAMANA algorithm.skipDecodeFields(String... fields) Set fields that should not be decoded from binary format (varargs).skipDecodeFields(List<String> skipDecodeFields) Set fields that should not be decoded from binary format.Set the sort field using SortField.Set the field name to sort results by (defaults to ascending).Set the sort field with explicit direction.Set the sort fields (supports multiple fields, but only first is used).sortDescending(boolean descending) Set whether to sort results in descending order.useSearchHistory(String useSearchHistory) Set the use search history parameter for SVS-VAMANA algorithm.vector(float[] vector) Set the query vector.
-
Method Details
-
vector
Set the query vector.- Parameters:
vector- Query vector for similarity search- Returns:
- This builder
-
field
Set the vector field name to search.- Parameters:
field- Name of the vector field- Returns:
- This builder
-
returnFields
Set the fields to return in results (varargs).- Parameters:
fields- Field names to return- Returns:
- This builder
-
returnFields
Set the fields to return in results (list).- Parameters:
fields- List of field names to return- Returns:
- This builder
-
distanceThreshold
Set the distance threshold for range filtering.- Parameters:
threshold- Maximum distance from query vector- Returns:
- This builder
-
numResults
Set the maximum number of results to return.- Parameters:
numResults- Maximum number of results- Returns:
- This builder
-
k
Deprecated.Use numResults() insteadSet the maximum number of results (deprecated alias).- Parameters:
k- Maximum number of results- Returns:
- This builder
-
returnScore
Set whether to return scores with results.- Parameters:
returnScore- True to return similarity scores- Returns:
- This builder
-
normalizeVectorDistance
Set whether to normalize vector distances.- Parameters:
normalize- True to normalize distances to [0, 1]- Returns:
- This builder
-
epsilon
Set the epsilon value for approximate HNSW search.- Parameters:
epsilon- Epsilon parameter for search precision- Returns:
- This builder
-
searchWindowSize
Set the search window size parameter for SVS-VAMANA algorithm.Controls the KNN search window size. Must be positive.
Python PR #439: SVS-VAMANA runtime parameter support
- Parameters:
searchWindowSize- Search window size (must be positive)- Returns:
- This builder
- Throws:
IllegalArgumentException- if searchWindowSize is not positive
-
useSearchHistory
Set the use search history parameter for SVS-VAMANA algorithm.Controls search buffer usage. Valid values: "OFF", "ON", "AUTO"
Python PR #439: SVS-VAMANA runtime parameter support
- Parameters:
useSearchHistory- Search history mode (OFF, ON, or AUTO)- Returns:
- This builder
- Throws:
IllegalArgumentException- if useSearchHistory is not one of: OFF, ON, AUTO
-
searchBufferCapacity
Set the search buffer capacity parameter for SVS-VAMANA algorithm.Controls compression tuning. Must be positive.
Python PR #439: SVS-VAMANA runtime parameter support
- Parameters:
searchBufferCapacity- Search buffer capacity (must be positive)- Returns:
- This builder
- Throws:
IllegalArgumentException- if searchBufferCapacity is not positive
-
sortBy
Set the field name to sort results by (defaults to ascending).Python equivalent: sort_by="price"
- Parameters:
sortBy- Field name for sorting- Returns:
- This builder
-
sortBy
Set the sort field with explicit direction.Python equivalent: sort_by=("price", "DESC")
- Parameters:
field- Field name to sort bydirection- Sort direction ("ASC" or "DESC", case-insensitive)- Returns:
- This builder
- Throws:
IllegalArgumentException- if direction is invalid
-
sortBy
Set the sort field using SortField.Python equivalent: sort_by=("rating", "DESC") or using SortField.desc("rating")
- Parameters:
sortField- SortField specifying field and direction- Returns:
- This builder
- Throws:
IllegalArgumentException- if sortField is null
-
sortBy
Set the sort fields (supports multiple fields, but only first is used).Python equivalent: sort_by=[("price", "DESC"), ("rating", "ASC"), "stock"]
Note: Redis Search only supports single-field sorting. When multiple fields are provided, only the first field is used and a warning is logged.
- Parameters:
sortFields- List of SortFields- Returns:
- This builder
-
sortDescending
Set whether to sort results in descending order.- Parameters:
descending- True for descending sort- Returns:
- This builder
-
inOrder
Set whether query terms must appear in order.- Parameters:
inOrder- True to enforce term order- Returns:
- This builder
-
skipDecodeFields
Set fields that should not be decoded from binary format.- Parameters:
skipDecodeFields- List of field names- Returns:
- This builder
- Throws:
IllegalArgumentException- if list contains null values
-
skipDecodeFields
Set fields that should not be decoded from binary format (varargs).- Parameters:
fields- Field names- Returns:
- This builder
- Throws:
IllegalArgumentException- if any field is null
-
build
Build the VectorRangeQuery instance.- Returns:
- Configured VectorRangeQuery
- Throws:
IllegalArgumentException- if vector or field is null
-