Class SerializedDocument
java.lang.Object
io.fluxzero.common.api.search.SerializedDocument
Represents a serialized form of a search document stored in a Fluxzero 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
Datablob for serialized storage and transmission - A lazily evaluated deserialized
Documentinstance 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 aSerializedDocumentfrom a deserializedDocumentrepresentation.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
Modifier and TypeMethodDescriptionintbytes()Returns the number of bytes in the serialized representation of the document.Returns the deserialized document view.Data<byte[]> Returns the serialized representation of the document.getEnd()Returns the adjusted end timestamp.withCollection(String collection) Creates a newSerializedDocumentinstance with the specified collection name.Returns a retrieval-only view that preserves the complete serialized payload and document identity while discarding all derived search data.
-
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 ofFacetEntryobjects, representing facet fields and values for searchabilityindexes- a set ofSortableEntryobjects, representing fields for sorting and fast range querying
-
SerializedDocument
-
-
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. -
withCollection
Creates a newSerializedDocumentinstance with the specified collection name. Updates the collection field of the document and its serialized representation if present.- Parameters:
collection- the name of the collection to associate with this document- Returns:
- a new
SerializedDocumentinstance with the updated collection
-
withoutSearchIndexes
Returns a retrieval-only view that preserves the complete serialized payload and document identity while discarding all derived search data.The returned document has no text summary, facets or sortable indexes. Its entries and metadata remain available for deserialization, including through a custom document serializer.
-
deserializeDocument
Returns the deserialized document view.
-