Class SerializedDocument

java.lang.Object
io.fluxcapacitor.common.api.search.SerializedDocument

public class SerializedDocument extends Object
Represents a serialized form of a search document stored in a Flux Capacitor collection.

A SerializedDocument contains all metadata and content necessary to index, search, or retrieve a document. It may encapsulate the document in two interchangeable forms:

  • A lazily evaluated Data blob for serialized storage and transmission
  • A lazily evaluated deserialized Document instance for programmatic access
Exactly one of data or document must be supplied during construction; the other will be lazily derived and memoized as needed.
See Also:
  • Constructor Details

    • SerializedDocument

      @ConstructorProperties({"id","timestamp","end","collection","document","summary","facets","indexes"}) public SerializedDocument(String id, Long timestamp, Long end, String collection, Data<byte[]> document, String summary, Set<FacetEntry> facets, Set<SortableEntry> indexes)
      Constructs a new instance of the SerializedDocument class with the specified parameters.
      Parameters:
      id - the unique identifier of the document
      timestamp - the creation timestamp of the document, in milliseconds since epoch
      end - the end timestamp of the document, in milliseconds since epoch, or null if not applicable
      collection - the name of the collection to which the document belongs
      document - the serialized data representing the document
      summary - a brief summary or description of the document
      facets - a set of FacetEntry objects, representing facet fields and values for searchability
      indexes - a set of SortableEntry objects, representing fields for sorting and fast range querying
    • SerializedDocument

      public SerializedDocument(Document document)
      Constructs a SerializedDocument from a deserialized Document representation. Automatically extracts and converts its metadata.
  • Method Details

    • getEnd

      public Long getEnd()
      Returns the adjusted end timestamp. If the end is null or invalid (i.e., before the start), the timestamp is returned instead.
    • getDocument

      public Data<byte[]> getDocument()
      Returns the serialized representation of the document.
    • bytes

      public int bytes()
      Returns the number of bytes in the serialized representation of the document.
    • deserializeDocument

      public Document deserializeDocument()
      Returns the deserialized document view.