Package com.redis.vl.query
Class FilterQuery
java.lang.Object
com.redis.vl.query.FilterQuery
A query for running a filtered search with a filter expression (no vector search).
Ported from Python: redisvl/query/query.py:314 (FilterQuery class)
Python equivalent:
FilterQuery(
filter_expression=Tag("credit_score") == "high",
return_fields=["user", "age"],
num_results=10,
sort_by="age"
)
Java equivalent:
FilterQuery.builder()
.filterExpression(Filter.tag("credit_score", "high"))
.returnFields(List.of("user", "age"))
.numResults(10)
.sortBy("age")
.build()
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for FilterQuery with defensive copying. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a new builder.redis.clients.jedis.search.QueryBuild Redis Query object from FilterQuery.intGet the query dialect.Get the filter expression.intGet the number of results to return.Get additional query parameters.Get the fields to return in results.Get the list of fields that should not be decoded from binary format.Get the field to sort by.booleanCheck if in-order matching is required.
-
Method Details
-
builder
Create a new builder.- Returns:
- A new FilterQueryBuilder instance
-
buildRedisQuery
public redis.clients.jedis.search.Query buildRedisQuery()Build Redis Query object from FilterQuery.Python equivalent: _build_query_string() method (line 368-372) Returns the filter expression string or '*' if no filter.
- Returns:
- Jedis Query object
-
getFilterExpression
Get the filter expression.- Returns:
- The filter expression
-
getReturnFields
Get the fields to return in results.- Returns:
- List of field names to return
-
getNumResults
public int getNumResults()Get the number of results to return.- Returns:
- Number of results
-
getDialect
public int getDialect()Get the query dialect.- Returns:
- RediSearch dialect version
-
getSortBy
Get the field to sort by.- Returns:
- Sort field name, or null if not sorting
-
isInOrder
public boolean isInOrder()Check if in-order matching is required.- Returns:
- true if terms must appear in same order as query
-
getParams
Get additional query parameters.- Returns:
- Map of parameter name to value
-
getSkipDecodeFields
Get the list of fields that should not be decoded from binary format.Python equivalent: _skip_decode_fields attribute (PR #389)
- Returns:
- List of field names to skip decoding
-