Class SearchQuery
java.lang.Object
io.fluxcapacitor.common.api.search.SearchQuery
A query for filtering documents in one or more search collections.
A SearchQuery
is used to retrieve documents from the search index by applying a combination of time-based
constraints, collection filters, and field-level constraints.
Example usage:
SearchQuery query = SearchQuery.builder()
.collection("complaints")
.since(Instant.parse("2023-01-01T00:00:00Z"))
.before(Instant.now())
.constraint(BetweenConstraint.atLeast(2, "priority"))
.build();
Fields
collections
: List of collection names to search in (required).since, before
: Start and end timestamps to filter documents within a time window.sinceExclusive, beforeInclusive
: Control boundary inclusivity for time filtering.constraints
: A list ofConstraint
objects applied to fields within the document.
Validation
The query must include at least one collection. An exception is thrown if none are specified.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class for constructing instances ofSearchQuery
. -
Constructor Summary
ConstructorsConstructorDescriptionSearchQuery
(List<String> collections, Instant since, Instant before, boolean sinceExclusive, boolean beforeInclusive, List<Constraint> constraints) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the given serialized document matches the query's constraints and collection filters.
-
Constructor Details
-
SearchQuery
-
-
Method Details
-
getBefore
-
matches
Checks if the given serialized document matches the query's constraints and collection filters.- Parameters:
d
- the serialized document to be checked; may be null. If null or if the collection of the document is not part of the query's collection filters, the method returns false.- Returns:
- true if the document meets the constraints and collection filters of the query, false otherwise.
-