Class SerializedDocument
java.lang.Object
io.fluxcapacitor.common.api.search.SerializedDocument
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
data
or document
must be supplied during construction; the other will be lazily
derived and memoized as needed.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSerializedDocument
(Document document) Constructs aSerializedDocument
from a deserializedDocument
representation.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. -
Method Summary
-
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 documenttimestamp
- the creation timestamp of the document, in milliseconds since epochend
- the end timestamp of the document, in milliseconds since epoch, or null if not applicablecollection
- the name of the collection to which the document belongsdocument
- the serialized data representing the documentsummary
- a brief summary or description of the documentfacets
- a set ofFacetEntry
objects, representing facet fields and values for searchabilityindexes
- a set ofSortableEntry
objects, representing fields for sorting and fast range querying
-
SerializedDocument
Constructs aSerializedDocument
from a deserializedDocument
representation. Automatically extracts and converts its metadata.
-
-
Method Details
-
getEnd
Returns the adjusted end timestamp. If the end is null or invalid (i.e., before the start), the timestamp is returned instead. -
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
Returns the deserialized document view.
-