Documentation
¶
Index ¶
- Variables
- type DictionaryIterator
- type DocVisitState
- type DocumentFieldTermVisitable
- type DocumentFieldValueVisitor
- type Location
- type OptimizablePostingsIterator
- type PersistedSegment
- type Plugin
- type Posting
- type PostingsIterator
- type PostingsList
- type Segment
- type StatsReporter
- type TermDictionary
- type UnpersistedSegment
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = fmt.Errorf("index closed")
Functions ¶
This section is empty.
Types ¶
type DictionaryIterator ¶
type DictionaryIterator interface {
Next() (*index.DictEntry, error)
}
type DocVisitState ¶
type DocVisitState interface {
}
type DocumentFieldTermVisitable ¶
type DocumentFieldTermVisitable interface {
VisitDocumentFieldTerms(localDocNum uint64, fields []string,
visitor index.DocumentFieldTermVisitor, optional DocVisitState) (DocVisitState, error)
// VisitableDocValueFields implementation should return
// the list of fields which are document value persisted and
// therefore visitable by the above VisitDocumentFieldTerms method.
VisitableDocValueFields() ([]string, error)
}
DocumentFieldTermVisitable is implemented by various scorch segment implementations with persistence for the un inverting of the postings or other indexed values.
type DocumentFieldValueVisitor ¶
DocumentFieldValueVisitor defines a callback to be visited for each stored field value. The return value determines if the visitor should keep going. Returning true continues visiting, false stops.
type PersistedSegment ¶
type Plugin ¶
type Plugin interface {
// Type is the name for this segment plugin
Type() string
// Version is a numeric value identifying a specific version of this type.
// When incompatible changes are made to a particular type of plugin, the
// version must be incremented.
Version() uint32
// New takes a set of AnalysisResults and turns them into a new Segment
New(results []*index.AnalysisResult) (Segment, uint64, error)
// Open attempts to open the file at the specified path and
// return the corresponding Segment
Open(path string) (Segment, error)
// Merge takes a set of Segments, and creates a new segment on disk at
// the specified path.
// Drops is a set of bitmaps (one for each segment) indicating which
// documents can be dropped from the segments during the merge.
// If the closeCh channel is closed, Merge will cease doing work at
// the next opportunity, and return an error (closed).
// StatsReporter can optionally be provided, in which case progress
// made during the merge is reported while operation continues.
// Returns:
// A slice of new document numbers (one for each input segment),
// this allows the caller to know a particular document's new
// document number in the newly merged segment.
// The number of bytes written to the new segment file.
// An error, if any occurred.
Merge(segments []Segment, drops []*roaring.Bitmap, path string,
closeCh chan struct{}, s StatsReporter) (
[][]uint64, uint64, error)
}
Plugin represents the essential functions required by a package to plug in it's segment implementation
type PostingsIterator ¶
type PostingsIterator interface {
// The caller is responsible for copying whatever it needs from
// the returned Posting instance before calling Next(), as some
// implementations may return a shared instance to reduce memory
// allocations.
Next() (Posting, error)
// Advance will return the posting with the specified doc number
// or if there is no such posting, the next posting.
// Callers MUST NOT attempt to pass a docNum that is less than or
// equal to the currently visited posting doc Num.
Advance(docNum uint64) (Posting, error)
Size() int
}
type PostingsList ¶
type PostingsList interface {
Iterator(includeFreq, includeNorm, includeLocations bool, prealloc PostingsIterator) PostingsIterator
Size() int
Count() uint64
}
type Segment ¶
type Segment interface {
Dictionary(field string) (TermDictionary, error)
VisitDocument(num uint64, visitor DocumentFieldValueVisitor) error
DocID(num uint64) ([]byte, error)
Count() uint64
DocNumbers([]string) (*roaring.Bitmap, error)
Fields() []string
Close() error
Size() int
AddRef()
DecRef() error
}
type StatsReporter ¶
type StatsReporter interface {
ReportBytesWritten(bytesWritten uint64)
}
type TermDictionary ¶
type TermDictionary interface {
PostingsList(term []byte, except *roaring.Bitmap, prealloc PostingsList) (PostingsList, error)
AutomatonIterator(a vellum.Automaton,
startKeyInclusive, endKeyExclusive []byte) DictionaryIterator
Contains(key []byte) (bool, error)
}
type UnpersistedSegment ¶
Click to show internal directories.
Click to hide internal directories.