Interface SearchClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemorySearchStore, WebSocketSearchClient
Low-level interface for interacting with a search and indexing service in Fluxzero.
The SearchClient operates exclusively on serialized forms of documents (see SerializedDocument) and
search-related requests. It is the primary interface used by internal components like
DocumentStore to execute actual search operations against a backing
implementation (e.g., Fluxzero Runtime or an in-memory search engine for testing).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbulkUpdate(Collection<DocumentUpdate> updates, Guarantee guarantee) Performs a batch update on a set of documents.voidclose()Closes any underlying resources.createAuditTrail(CreateAuditTrail request) Configures Fluxzero to use a search collection as a searchable audit trail.delete(SearchQuery query, Guarantee guarantee) Deletes documents matching a given query.Deletes a document by its unique id and collection name.default CompletableFuture<Void> deleteCollection(String collection) Deletes an entire document collection and all its contents.deleteCollection(String collection, Guarantee guarantee) Deletes an entire document collection and all its contents.booleandocumentExists(HasDocument request) Checks whether a document with the given criteria exists.fetch(GetDocument request) Fetches a single serialized document matching the given request.fetch(GetDocuments request) Fetches a collection of serialized documents that match the given request.fetchFacetStats(SearchQuery query) Retrieves facet statistics (i.e., value counts) for a given query.fetchHistogram(GetSearchHistogram request) Fetches a histogram (bucketed time-series view) for documents matching the query.fetchStatistics(SearchQuery query, List<String> fields, List<String> groupBy) Retrieves search statistics (counts, averages, etc.) over matching documents.index(List<SerializedDocument> documents, Guarantee guarantee, boolean ifNotExists) Indexes a list of serialized documents into the search engine.move(SearchQuery query, String targetCollection, Guarantee guarantee) Moves documents matching a given query to the given target collection.Moves a document to another collection.search(SearchDocuments searchDocuments, int fetchSize) Executes a streaming search query using the given criteria and fetch size.
-
Method Details
-
index
CompletableFuture<Void> index(List<SerializedDocument> documents, Guarantee guarantee, boolean ifNotExists) Indexes a list of serialized documents into the search engine.- Parameters:
documents- the documents to indexguarantee- delivery guarantee (seeGuarantee)ifNotExists- iftrue, only index documents that do not already exist- Returns:
- a future that completes when the operation is done
-
search
Executes a streaming search query using the given criteria and fetch size.- Parameters:
searchDocuments- the search parameters and queryfetchSize- the number of results to fetch per page- Returns:
- a stream of search hits matching the query
-
documentExists
Checks whether a document with the given criteria exists.- Parameters:
request- an object describing the document (e.g., id and collection)- Returns:
trueif the document exists,falseotherwise
-
fetch
Fetches a single serialized document matching the given request.- Parameters:
request- an object describing the document to retrieve- Returns:
- an optional containing the document, if found
-
fetch
Fetches a collection of serialized documents that match the given request.- Parameters:
request- an object describing the documents to retrieve- Returns:
- a collection of retrieved documents matching
-
delete
Deletes documents matching a given query.- Parameters:
query- the search query specifying which documents to deleteguarantee- delivery guarantee- Returns:
- a future that completes when the deletion has been performed
-
move
Moves documents matching a given query to the given target collection.- Parameters:
query- the search query specifying which documents to movetargetCollection- the name of the collection to move documents toguarantee- delivery guarantee- Returns:
- a future that completes when the move has been performed
-
delete
Deletes a document by its unique id and collection name.- Parameters:
documentId- the document idcollection- the collection to delete fromguarantee- delivery guarantee- Returns:
- a future that completes when the deletion has been performed
-
move
CompletableFuture<Void> move(String documentId, String collection, String targetCollection, Guarantee guarantee) Moves a document to another collection.- Parameters:
documentId- the document idcollection- the collection to move fromtargetCollection- the collection to move toguarantee- delivery guarantee- Returns:
- a future that completes when the move has been performed
-
createAuditTrail
Configures Fluxzero to use a search collection as a searchable audit trail.- Parameters:
request- a request object specifying the collection to use as an audit trail and retention configuration- Returns:
- a future that completes when the audit trail has been created.
-
deleteCollection
Deletes an entire document collection and all its contents.- Parameters:
collection- the name of the collection to delete- Returns:
- a future that completes when the collection has been deleted
-
deleteCollection
Deletes an entire document collection and all its contents.- Parameters:
collection- the name of the collection to deleteguarantee- delivery guarantee- Returns:
- a future that completes when the collection has been deleted
-
fetchStatistics
Retrieves search statistics (counts, averages, etc.) over matching documents.- Parameters:
query- the query to filter documentsfields- the fields to compute statistics forgroupBy- field names used to group statistics- Returns:
- a list of
DocumentStats
-
fetchHistogram
Fetches a histogram (bucketed time-series view) for documents matching the query.- Parameters:
request- the histogram query parameters- Returns:
- a
SearchHistogramrepresenting the result
-
fetchFacetStats
Retrieves facet statistics (i.e., value counts) for a given query.- Parameters:
query- the query to match documents against- Returns:
- a list of facet statistics
-
bulkUpdate
Performs a batch update on a set of documents.- Parameters:
updates- the update operations to performguarantee- delivery guarantee- Returns:
- a future that completes when the updates have been applied
-
close
-