Class DefaultDocumentStore.DefaultSearch

java.lang.Object
io.fluxzero.sdk.persisting.search.DefaultDocumentStore.DefaultSearch
All Implemented Interfaces:
Search
Enclosing class:
DefaultDocumentStore

protected class DefaultDocumentStore.DefaultSearch extends Object implements Search
  • Constructor Details

    • DefaultSearch

      protected DefaultSearch()
  • Method Details

    • since

      public Search since(Instant start, boolean inclusive)
      Description copied from interface: Search
      Filters documents with timestamps since the given start time.
      Specified by:
      since in interface Search
      Parameters:
      inclusive - whether the start boundary is inclusive
    • before

      public Search before(Instant end, boolean inclusive)
      Description copied from interface: Search
      Filters documents with timestamps before the given time.
      Specified by:
      before in interface Search
      Parameters:
      inclusive - whether the end boundary is inclusive
    • inPeriod

      public Search inPeriod(Instant start, boolean startInclusive, Instant end, boolean endInclusive)
      Description copied from interface: Search
      Filters documents within a specified time range.
      Specified by:
      inPeriod in interface Search
    • constraint

      public Search constraint(Constraint... constraints)
      Description copied from interface: Search
      Adds one or more custom constraints to the search using a logical AND.
      Specified by:
      constraint in interface Search
    • sortByTimestamp

      public Search sortByTimestamp(boolean descending)
      Description copied from interface: Search
      Sorts results by timestamp.
      Specified by:
      sortByTimestamp in interface Search
      Parameters:
      descending - whether to sort in descending order
    • sortByScore

      public Search sortByScore()
      Description copied from interface: Search
      Sorts results by full-text relevance score.
      Specified by:
      sortByScore in interface Search
    • sortBy

      public Search sortBy(String path, boolean descending)
      Description copied from interface: Search
      Sorts results by a field, with control over the sort direction.
      Specified by:
      sortBy in interface Search
    • exclude

      public Search exclude(String... paths)
      Description copied from interface: Search
      Excludes specific fields from the returned documents.
      Specified by:
      exclude in interface Search
    • includeOnly

      public Search includeOnly(String... paths)
      Description copied from interface: Search
      Includes only the specified fields in the returned documents.
      Specified by:
      includeOnly in interface Search
    • skip

      public Search skip(Integer n)
      Description copied from interface: Search
      Skips the first N results.
      Specified by:
      skip in interface Search
    • streamHits

      public <T> Stream<SearchHit<T>> streamHits()
      Description copied from interface: Search
      Streams raw search hits (document + metadata). Documents will typically be fetched in batches from the backing store. For the default implementation, the fetch size is 10,000.
      Specified by:
      streamHits in interface Search
    • streamHits

      public <T> Stream<SearchHit<T>> streamHits(int fetchSize)
      Description copied from interface: Search
      Streams raw search hits (document + metadata). Documents will be fetched in batches of size fetchSize from the backing store. For the default implementation, the fetch size is 10,000.
      Specified by:
      streamHits in interface Search
    • streamHits

      public <T> Stream<SearchHit<T>> streamHits(Class<T> type)
      Description copied from interface: Search
      Streams raw search hits (document + metadata). Documents will be fetched in batches of size fetchSize from the backing store. For the default implementation, the fetch size is 10,000.
      Specified by:
      streamHits in interface Search
    • streamHits

      public <T> Stream<SearchHit<T>> streamHits(Class<T> type, int fetchSize)
      Description copied from interface: Search
      Streams raw search hits (document + metadata). Documents will be fetched in batches of size fetchSize from the backing store. For the default implementation, the fetch size is 10,000.
      Specified by:
      streamHits in interface Search
    • fetch

      public <T> List<T> fetch(int maxSize)
      Description copied from interface: Search
      Fetches up to the given number of matching documents and deserializes them to the stored type. Returns the deserialized values as instances of type T.
      Specified by:
      fetch in interface Search
    • fetch

      public <T> List<T> fetch(int maxSize, Class<T> type)
      Description copied from interface: Search
      Fetches up to the given number of documents and deserializes them to the specified type.
      Specified by:
      fetch in interface Search
    • fetchAsync

      public <T> CompletableFuture<List<T>> fetchAsync(int maxSize)
      Description copied from interface: Search
      Asynchronously fetches up to the given number of matching documents and deserializes them to the stored type.

      This is the asynchronous counterpart of Search.fetch(int). The returned future completes with a materialized list containing at most maxSize results.

      Specified by:
      fetchAsync in interface Search
      Type Parameters:
      T - the expected result type
      Parameters:
      maxSize - the maximum number of matching documents to fetch
      Returns:
      a future containing the deserialized search results
    • fetchAsync

      public <T> CompletableFuture<List<T>> fetchAsync(int maxSize, Class<T> type)
      Description copied from interface: Search
      Asynchronously fetches up to the given number of documents and deserializes them to the specified type.

      This is the asynchronous counterpart of Search.fetch(int, Class). Use this method when handling requests that can return a CompletableFuture; for very large result sets, prefer the streaming methods.

      Specified by:
      fetchAsync in interface Search
      Type Parameters:
      T - the expected result type
      Parameters:
      maxSize - the maximum number of matching documents to fetch
      type - the type to deserialize each document to
      Returns:
      a future containing the deserialized search results
    • fetchHitStream

      protected <T> Stream<SearchHit<T>> fetchHitStream(Integer maxSize, Class<T> type)
    • fetchHitStream

      protected <T> Stream<SearchHit<T>> fetchHitStream(Integer maxSize, Class<T> type, int fetchSize)
    • fetchHistogram

      public SearchHistogram fetchHistogram(int resolution, int maxSize)
      Description copied from interface: Search
      Computes a histogram for the timestamp distribution of matching documents.
      Specified by:
      fetchHistogram in interface Search
    • groupBy

      public GroupSearch groupBy(String... paths)
      Description copied from interface: Search
      Groups search results by field(s) and supports aggregations.
      Specified by:
      groupBy in interface Search
    • facetStats

      public List<FacetStats> facetStats()
      Description copied from interface: Search
      Returns facet statistics for the current search.
      Specified by:
      facetStats in interface Search
    • facetStatsAsync

      public CompletableFuture<List<FacetStats>> facetStatsAsync()
      Description copied from interface: Search
      Asynchronously returns facet statistics for the current search.

      This is the asynchronous counterpart of Search.facetStats().

      Specified by:
      facetStatsAsync in interface Search
      Returns:
      a future containing facet value counts for the matching documents
    • delete

      public CompletableFuture<Void> delete()
      Description copied from interface: Search
      Deletes all matching documents in the current search.
      Specified by:
      delete in interface Search
    • move

      public CompletableFuture<Void> move(Object targetCollection)
      Description copied from interface: Search
      Moves all matching documents in the current search to the given collection.
      Specified by:
      move in interface Search
      Parameters:
      targetCollection - the collection to move to