Documentation
¶
Index ¶
- Constants
- Variables
- func Merge(segments []*Segment, drops []*roaring.Bitmap) segment.Merger
- type CollectionStats
- type DictEntry
- type Dictionary
- func (d *Dictionary) Close() error
- func (d *Dictionary) Contains(key []byte) (bool, error)
- func (d *Dictionary) Iterator(a vellum.Automaton, startKeyInclusive, endKeyExclusive []byte) segment.DictionaryIterator
- func (d *Dictionary) PostingsList(term []byte, except *roaring.Bitmap, prealloc *PostingsList) (*PostingsList, error)
- type DictionaryIterator
- type DocumentTermsEntry
- type DocumentValueReader
- type DocumentsTermsMap
- type Location
- type Merger
- type Posting
- type PostingsIterator
- func (i *PostingsIterator) ActualBitmap() *roaring.Bitmap
- func (i *PostingsIterator) Advance(docNum uint64) (*Posting, error)
- func (i *PostingsIterator) Close() error
- func (i *PostingsIterator) Count() uint64
- func (i *PostingsIterator) DocNum1Hit() (uint64, bool)
- func (i *PostingsIterator) Empty() bool
- func (i *PostingsIterator) Next() (*Posting, error)
- func (i *PostingsIterator) ReplaceActual(abm *roaring.Bitmap)
- func (i *PostingsIterator) Size() int
- type PostingsList
- type Segment
- func (s *Segment) CRC() uint32
- func (s *Segment) ChunkMode() uint32
- func (s *Segment) CollectionStats(field string) (stats CollectionStats)
- func (s *Segment) Count() uint64
- func (s *Segment) Dictionary(field string) (*Dictionary, error)
- func (s *Segment) DocValueOffset() uint64
- func (s *Segment) DocsMatchingTerms(terms []*analysis.TokenFreq) (*roaring.Bitmap, error)
- func (s *Segment) DocumentValueReader(fields []string) (segment.DocumentValueReader, error)
- func (s *Segment) Fields() []string
- func (s *Segment) FieldsIndexOffset() uint64
- func (s *Segment) NumDocs() uint64
- func (s *Segment) Size() int
- func (s *Segment) StoredIndexOffset() uint64
- func (s *Segment) Type() string
- func (s *Segment) Version() uint32
- func (s *Segment) VisitStoredFields(num uint64, visitor segment.StoredFieldVisitor) error
- func (s *Segment) WriteTo(w io.Writer, _ chan struct{}) (int64, error)
- type Term
Constants ¶
const DefaultFileMergerBufferSize = 1024 * 1024
const Type string = "ice"
const Version uint32 = 1
Variables ¶
var EmptyPostingsIterator = &PostingsIterator{}
var EmptyPostingsList = &PostingsList{}
represents an immutable, empty postings list
var UnsafeRoaringBitmapsPool = pool.New[roaring.Bitmap](20)
Thread unsafe threat with caution
Functions ¶
Types ¶
type CollectionStats ¶
type CollectionStats struct {
TotalDocumentCount uint64
DocumentCount uint64
SumTotalTermFrequency uint64
}
func (*CollectionStats) Merge ¶
func (c *CollectionStats) Merge(other *CollectionStats)
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
Dictionary is the representation of the term dictionary
func (*Dictionary) Close ¶
func (d *Dictionary) Close() error
func (*Dictionary) Iterator ¶
func (d *Dictionary) Iterator(a vellum.Automaton, startKeyInclusive, endKeyExclusive []byte) segment.DictionaryIterator
Iterator returns an iterator which only visits terms having the the vellum automaton and start/end key range
func (*Dictionary) PostingsList ¶
func (d *Dictionary) PostingsList(term []byte, except *roaring.Bitmap, prealloc *PostingsList) (*PostingsList, error)
PostingsList returns the postings list for the specified term
type DictionaryIterator ¶
type DictionaryIterator struct {
// contains filtered or unexported fields
}
DictionaryIterator is an iterator for term dictionary
func (*DictionaryIterator) Close ¶
func (i *DictionaryIterator) Close() error
func (*DictionaryIterator) Next ¶
func (i *DictionaryIterator) Next() (segment.DictionaryEntry, error)
Next returns the next entry in the dictionary
type DocumentTermsEntry ¶
type DocumentValueReader ¶
type DocumentValueReader struct {
// contains filtered or unexported fields
}
func (*DocumentValueReader) VisitDocumentValues ¶
func (d *DocumentValueReader) VisitDocumentValues(number uint64, visitor segment.DocumentValueVisitor) error
type DocumentsTermsMap ¶
type DocumentsTermsMap struct {
Entries []DocumentTermsEntry
}
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
Location represents the location of a single occurrence
func (*Location) Field ¶
Field returns the name of the field (useful in composite fields to know which original field the value came from)
type Merger ¶
type Merger struct {
// contains filtered or unexported fields
}
func (*Merger) DocumentNumbers ¶
type Posting ¶
type Posting struct {
// contains filtered or unexported fields
}
Posting is a single entry in a postings list
func (*Posting) Frequency ¶
Frequency returns the frequencies of occurrence of this term in this doc/field
type PostingsIterator ¶
type PostingsIterator struct {
Actual roaring.IntPeekable
// unadornedBM is set when this iterator is used in "unadorned bitmap" mode,
// bypassing all freq/norm/loc machinery entirely.
UnadornedBM *roaring.Bitmap
ActualBM *roaring.Bitmap
// contains filtered or unexported fields
}
PostingsIterator provides a way to iterate through the postings list
func NewUnadornedPostingsIteratorFrom1Hit ¶
func NewUnadornedPostingsIteratorFrom1Hit(docNum uint64) *PostingsIterator
NewUnadornedPostingsIteratorFrom1Hit returns a PostingsIterator for a single document with no freq/norm/loc decoding.
func NewUnadornedPostingsIteratorFromBitmap ¶
func NewUnadornedPostingsIteratorFromBitmap(bm *roaring.Bitmap) *PostingsIterator
NewUnadornedPostingsIteratorFromBitmap returns a PostingsIterator that iterates over bm with no freq/norm/loc decoding.
func (*PostingsIterator) ActualBitmap ¶
func (i *PostingsIterator) ActualBitmap() *roaring.Bitmap
ActualBitmap returns the underlying actual bitmap which can be used up the stack for optimizations
func (*PostingsIterator) Advance ¶
func (i *PostingsIterator) Advance(docNum uint64) (*Posting, error)
Advance returns the posting at the specified docNum or it is not present the next posting, or if the end is reached, nil
func (*PostingsIterator) Close ¶
func (i *PostingsIterator) Close() error
func (*PostingsIterator) Count ¶
func (i *PostingsIterator) Count() uint64
func (*PostingsIterator) DocNum1Hit ¶
func (i *PostingsIterator) DocNum1Hit() (uint64, bool)
DocNum1Hit returns the docNum and true if this is "1-hit" optimized and the docNum is available.
func (*PostingsIterator) Empty ¶
func (i *PostingsIterator) Empty() bool
func (*PostingsIterator) Next ¶
func (i *PostingsIterator) Next() (*Posting, error)
Next returns the next posting on the postings list, or nil at the end
func (*PostingsIterator) ReplaceActual ¶
func (i *PostingsIterator) ReplaceActual(abm *roaring.Bitmap)
ReplaceActual replaces the ActualBM with the provided bitmap
func (*PostingsIterator) Size ¶
func (i *PostingsIterator) Size() int
type PostingsList ¶
type PostingsList struct {
// contains filtered or unexported fields
}
PostingsList is an in-memory representation of a postings list
func (*PostingsList) Count ¶
func (p *PostingsList) Count() uint64
Count returns the number of items on this postings list
func (*PostingsList) Iterator ¶
func (p *PostingsList) Iterator(includeFreq, includeNorm, includeLocs bool, prealloc *PostingsIterator) (*PostingsIterator, error)
Iterator returns an iterator for this postings list
func (*PostingsList) OrInto ¶
func (p *PostingsList) OrInto(receiver *roaring.Bitmap)
func (*PostingsList) Size ¶
func (p *PostingsList) Size() int
type Segment ¶
type Segment struct {
// contains filtered or unexported fields
}
func New ¶
func New(results []*documents.Document, normCalc func(string, int) float32) ( *Segment, uint64, error)
New creates an in-memory implementation of a segment for the source documents
func (*Segment) CollectionStats ¶
func (s *Segment) CollectionStats(field string) (stats CollectionStats)
func (*Segment) Dictionary ¶
func (s *Segment) Dictionary(field string) (*Dictionary, error)
DictionaryReader returns the term dictionary for the specified field
func (*Segment) DocValueOffset ¶
DocValueOffset returns the docValue offset in the file footer
func (*Segment) DocsMatchingTerms ¶
func (*Segment) DocumentValueReader ¶
func (s *Segment) DocumentValueReader(fields []string) (segment.DocumentValueReader, error)
func (*Segment) FieldsIndexOffset ¶
FieldsIndexOffset returns the fields index offset in the file footer
func (*Segment) StoredIndexOffset ¶
StoredIndexOffset returns the stored value index offset in the file footer
func (*Segment) VisitStoredFields ¶
func (s *Segment) VisitStoredFields(num uint64, visitor segment.StoredFieldVisitor) error
VisitStoredFields invokes the DocFieldValueVistor for each stored field for the specified doc number