Documentation ¶
Index ¶
- func MetadataFromDocument(document doc.Document, reader *EncodedDocumentReader) (doc.Metadata, error)
- func ReadEncodedDocumentID(encoded doc.Encoded) ([]byte, error)
- func ReadIDFromDocument(document doc.Document) ([]byte, error)
- type DataReader
- type DataWriter
- type EncodedDataReader
- type EncodedDocumentReader
- type IndexReader
- type IndexWriter
- type Reader
- type SliceReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MetadataFromDocument ¶ added in v1.0.1
func MetadataFromDocument(document doc.Document, reader *EncodedDocumentReader) (doc.Metadata, error)
MetadataFromDocument retrieves a doc.Metadata from a doc.Document.
func ReadEncodedDocumentID ¶ added in v1.0.1
ReadEncodedDocumentID reads the document ID from the encoded document metadata.
Types ¶
type DataReader ¶
type DataReader struct {
// contains filtered or unexported fields
}
DataReader is a reader for the data file for documents.
func NewDataReader ¶
func NewDataReader(data []byte) *DataReader
NewDataReader returns a new DataReader.
type DataWriter ¶
type DataWriter struct {
// contains filtered or unexported fields
}
DataWriter writes the data file for documents.
func NewDataWriter ¶
func NewDataWriter(w io.Writer) *DataWriter
NewDataWriter returns a new DataWriter.
type EncodedDataReader ¶ added in v1.0.1
type EncodedDataReader struct {
// contains filtered or unexported fields
}
EncodedDataReader is a reader for the data file for encoded document metadata.
func NewEncodedDataReader ¶ added in v1.0.1
func NewEncodedDataReader(data []byte) *EncodedDataReader
NewEncodedDataReader returns a new EncodedDataReader.
type EncodedDocumentReader ¶ added in v1.0.1
type EncodedDocumentReader struct {
// contains filtered or unexported fields
}
EncodedDocumentReader is a reader for reading documents from encoded metadata.
func NewEncodedDocumentReader ¶ added in v1.0.1
func NewEncodedDocumentReader() *EncodedDocumentReader
NewEncodedDocumentReader returns a new EncodedDocumentReader.
func (*EncodedDocumentReader) Read ¶ added in v1.0.1
Read reads a doc.Metadata from a doc.Encoded. Returned doc.Metadata should be processed before calling Read again as the underlying array pointed to by the Fields slice will be updated. This approach avoids allocating a new slice with a new backing array for every document processed, unlike (*DataReader).Read
type IndexReader ¶
type IndexReader struct {
// contains filtered or unexported fields
}
IndexReader is a reader for the index file for documents.
func NewIndexReader ¶
func NewIndexReader(data []byte) (*IndexReader, error)
NewIndexReader returns a new IndexReader.
func (*IndexReader) Base ¶
func (r *IndexReader) Base() postings.ID
Base returns the base postings ID.
type IndexWriter ¶
type IndexWriter struct {
// contains filtered or unexported fields
}
IndexWriter is a writer for the index file for documents.
func NewIndexWriter ¶
func NewIndexWriter(w io.Writer) *IndexWriter
NewIndexWriter returns a new IndexWriter.
type Reader ¶ added in v0.15.14
type Reader interface { // Len is the number of documents contained by the reader. Len() int // Read reads a document with the given postings ID. Read(id postings.ID) (doc.Metadata, error) // Iter returns a document iterator. Iter() index.IDDocIterator }
Reader is a document reader from an encoded source.
type SliceReader ¶ added in v0.5.0
type SliceReader struct {
// contains filtered or unexported fields
}
SliceReader is a docs slice reader for use with documents stored in memory.
func NewSliceReader ¶ added in v0.5.0
func NewSliceReader(docs []doc.Metadata) *SliceReader
NewSliceReader returns a new docs slice reader.
func (*SliceReader) Iter ¶ added in v0.15.14
func (r *SliceReader) Iter() index.IDDocIterator
Iter returns a docs iterator.
func (*SliceReader) Len ¶ added in v0.5.0
func (r *SliceReader) Len() int
Len returns the number of documents in the slice reader.