Documentation ¶
Index ¶
- Constants
- Variables
- func Compare[T int | int32 | int64 | float32 | float64](x, y T) int
- func FeatureRequested(flags, feature int) bool
- func FileNameFromGeneration(base, ext string, gen int64) string
- func GenerationFromSegmentsFileName(fileName string) (int64, error)
- func GetActualMaxDocs() int
- func GetLastCommitGeneration(files []string) int64
- func GetLastCommitSegmentsFileName(files []string) string
- func ImpactComparator(c1, c2 *Impact) int
- func IndexExists(dir store.Directory) (bool, error)
- func ParseGeneration(filename string) int64
- func ParseSegmentName(filename string) string
- func Partition(config *bkd.Config, maxDoc, splitDim, commonPrefixLen int, ...)
- func RegisterCodec(codec Codec)
- func RegisterSortFieldProvider(provider SortFieldProvider)
- func SegmentFileName(segmentName, segmentSuffix, ext string) string
- func SortByDim(config *bkd.Config, sortedDim int, commonPrefixLengths []int, ...)
- func SortFreqProxTermsWriterPerField(fields []*FreqProxTermsWriterPerField)
- func SortTermVectorsConsumerPerField(fields []*TermVectorsConsumerPerField)
- func StripExtension(filename string) string
- func StripSegmentName(filename string) string
- func SubIndex(n int, docStarts []int) int
- func TermCompare(a, b *Term) int
- func TestLiveDocs(reader CodecReader) error
- func WriteSortField(sf SortField, output store.DataOutput) error
- type AcceptStatus
- type AutomatonTermsEnum
- type BaseCodecReader
- func (c *BaseCodecReader) CheckIntegrity() error
- func (c *BaseCodecReader) DocumentV1(docID int, visitor document.StoredFieldVisitor) error
- func (c *BaseCodecReader) GetBinaryDocValues(field string) (BinaryDocValues, error)
- func (c *BaseCodecReader) GetNormValues(field string) (NumericDocValues, error)
- func (c *BaseCodecReader) GetNumericDocValues(field string) (NumericDocValues, error)
- func (c *BaseCodecReader) GetPointValues(field string) (types.PointValues, bool)
- func (c *BaseCodecReader) GetSortedDocValues(field string) (SortedDocValues, error)
- func (c *BaseCodecReader) GetSortedNumericDocValues(field string) (SortedNumericDocValues, error)
- func (c *BaseCodecReader) GetSortedSetDocValues(field string) (SortedSetDocValues, error)
- func (c *BaseCodecReader) GetTermVectors(docID int) (Fields, error)
- func (c *BaseCodecReader) Terms(field string) (Terms, error)
- type BaseCompositeReader
- func (b *BaseCompositeReader) DoClose() error
- func (b *BaseCompositeReader) DocFreq(ctx context.Context, term Term) (int, error)
- func (b *BaseCompositeReader) DocumentV1(docID int, visitor document.StoredFieldVisitor) error
- func (b *BaseCompositeReader) GetContext() (ReaderContext, error)
- func (b *BaseCompositeReader) GetDocCount(field string) (int, error)
- func (b *BaseCompositeReader) GetMetaData() *LeafMetaData
- func (b *BaseCompositeReader) GetReaderCacheHelper() CacheHelper
- func (b *BaseCompositeReader) GetSequentialSubReaders() []Reader
- func (b *BaseCompositeReader) GetSumDocFreq(field string) (int64, error)
- func (b *BaseCompositeReader) GetSumTotalTermFreq(field string) (int64, error)
- func (b *BaseCompositeReader) GetTermVectors(docID int) (Fields, error)
- func (b *BaseCompositeReader) MaxDoc() int
- func (b *BaseCompositeReader) NumDocs() int
- func (b *BaseCompositeReader) TotalTermFreq(ctx context.Context, term *Term) (int64, error)
- type BaseLeafReader
- func (r *BaseLeafReader) DocFreq(ctx context.Context, term Term) (int, error)
- func (r *BaseLeafReader) GetContext() (ReaderContext, error)
- func (r *BaseLeafReader) GetDocCount(field string) (int, error)
- func (r *BaseLeafReader) GetSumDocFreq(field string) (int64, error)
- func (r *BaseLeafReader) GetSumTotalTermFreq(field string) (int64, error)
- func (r *BaseLeafReader) Postings(ctx context.Context, term *Term, flags int) (PostingsEnum, error)
- func (r *BaseLeafReader) TotalTermFreq(ctx context.Context, term *Term) (int64, error)
- type BasePointsWriter
- type BaseSortField
- func (s *BaseSortField) Equals(other SortField) bool
- func (s *BaseSortField) GetBytesComparator() BytesComparator
- func (s *BaseSortField) GetCanUsePoints() bool
- func (s *BaseSortField) GetComparator(numHits, sortPos int) FieldComparator
- func (s *BaseSortField) GetComparatorSource() FieldComparatorSource
- func (s *BaseSortField) GetField() string
- func (s *BaseSortField) GetIndexSorter() IndexSorter
- func (s *BaseSortField) GetMissingValue() any
- func (s *BaseSortField) GetReverse() bool
- func (s *BaseSortField) GetType() SortFieldType
- func (s *BaseSortField) NeedsScores() bool
- func (s *BaseSortField) Serialize(ctx context.Context, out store.DataOutput) error
- func (s *BaseSortField) SetBytesComparator(fn BytesComparator)
- func (s *BaseSortField) SetCanUsePoints()
- func (s *BaseSortField) SetMissingValue(missingValue any) error
- func (s *BaseSortField) String() string
- type BaseSortedDocValues
- type BaseTermsEnum
- type BaseTermsEnumConfig
- type BaseTermsHash
- func (h *BaseTermsHash) Abort() error
- func (h *BaseTermsHash) FinishDocument(docID int) error
- func (h *BaseTermsHash) Flush(fieldsToFlush map[string]TermsHashPerField, state *SegmentWriteState, ...) error
- func (h *BaseTermsHash) GetBytePool() *bytesref.BlockPool
- func (h *BaseTermsHash) GetIntPool() *ints.BlockPool
- func (h *BaseTermsHash) GetTermBytePool() *bytesref.BlockPool
- func (h *BaseTermsHash) Reset() error
- func (h *BaseTermsHash) StartDocument() error
- type BinaryDocValues
- type BinaryDocValuesDefault
- func (n *BinaryDocValuesDefault) Advance(target int) (int, error)
- func (n *BinaryDocValuesDefault) AdvanceExact(target int) (bool, error)
- func (n *BinaryDocValuesDefault) BinaryValue() ([]byte, error)
- func (n *BinaryDocValuesDefault) Cost() int64
- func (n *BinaryDocValuesDefault) DocID() int
- func (n *BinaryDocValuesDefault) NextDoc() (int, error)
- func (n *BinaryDocValuesDefault) SlowAdvance(target int) (int, error)
- type BinaryDocValuesFieldUpdates
- func (b *BinaryDocValuesFieldUpdates) AddBytes(doc int, value []byte) error
- func (b *BinaryDocValuesFieldUpdates) AddInt64(doc int, value int64) error
- func (b *BinaryDocValuesFieldUpdates) AddIterator(doc int, it DocValuesFieldUpdatesIterator) error
- func (b *BinaryDocValuesFieldUpdates) EnsureFinished() error
- func (b *BinaryDocValuesFieldUpdates) Finish() error
- func (b *BinaryDocValuesFieldUpdates) Grow(size int) error
- func (b *BinaryDocValuesFieldUpdates) Iterator() (DocValuesFieldUpdatesIterator, error)
- func (b *BinaryDocValuesFieldUpdates) Reset(doc int) error
- func (b *BinaryDocValuesFieldUpdates) Resize(size int) error
- func (b *BinaryDocValuesFieldUpdates) Swap(i, j int) error
- type BinaryDocValuesUpdate
- func (b *BinaryDocValuesUpdate) GetDocValuesType() document.DocValuesType
- func (b *BinaryDocValuesUpdate) GetOptions() *DocValuesUpdateOptions
- func (b *BinaryDocValuesUpdate) HasValue() bool
- func (b *BinaryDocValuesUpdate) ValueSizeInBytes() int64
- func (b *BinaryDocValuesUpdate) ValueToString() string
- func (b *BinaryDocValuesUpdate) WriteTo(output store.DataOutput) error
- type BinaryDocValuesWriter
- type BitSetIterator
- type BufferedBinaryDocValues
- func (b *BufferedBinaryDocValues) Advance(target int) (int, error)
- func (b *BufferedBinaryDocValues) AdvanceExact(target int) (bool, error)
- func (b *BufferedBinaryDocValues) BinaryValue() ([]byte, error)
- func (b *BufferedBinaryDocValues) Cost() int64
- func (b *BufferedBinaryDocValues) DocID() int
- func (b *BufferedBinaryDocValues) NextDoc() (int, error)
- func (b *BufferedBinaryDocValues) SlowAdvance(target int) (int, error)
- type BufferedNumericDocValues
- func (b *BufferedNumericDocValues) Advance(target int) (int, error)
- func (b *BufferedNumericDocValues) AdvanceExact(target int) (bool, error)
- func (b *BufferedNumericDocValues) Cost() int64
- func (b *BufferedNumericDocValues) DocID() int
- func (b *BufferedNumericDocValues) LongValue() (int64, error)
- func (b *BufferedNumericDocValues) NextDoc() (int, error)
- func (b *BufferedNumericDocValues) SlowAdvance(target int) (int, error)
- type BufferedUpdates
- type BufferedUpdatesOption
- type BufferedUpdatesStream
- type ByteSliceReader
- type BytesComparator
- type CacheHelper
- type ClosedListener
- type Codec
- type CodecReader
- type CodecReaderDefaultSPI
- type CommitPoint
- func (c *CommitPoint) CompareTo(commit IndexCommit) int
- func (c *CommitPoint) Delete() error
- func (c *CommitPoint) GetDirectory() store.Directory
- func (c *CommitPoint) GetFileNames() (map[string]struct{}, error)
- func (c *CommitPoint) GetGeneration() int64
- func (c *CommitPoint) GetReader() *StandardDirectoryReader
- func (c *CommitPoint) GetSegmentCount() int
- func (c *CommitPoint) GetSegmentsFileName() string
- func (c *CommitPoint) GetUserData() (map[string]string, error)
- func (c *CommitPoint) IsDeleted() bool
- type ComparableProvider
- type CompetitiveImpactAccumulator
- type CompositeReader
- type CompositeReaderBuilder
- type CompositeReaderContext
- type CompositeReaderContextOption
- func WithCompositeReaderContextV1(reader CompositeReader) CompositeReaderContextOption
- func WithCompositeReaderContextV2(parent *CompositeReaderContext, reader CompositeReader, ...) CompositeReaderContextOption
- func WithCompositeReaderContextV3(reader CompositeReader, children, leaves *arraylist.List[ReaderContext]) CompositeReaderContextOption
- type CompoundDirectory
- type CompoundDirectoryDefault
- func (*CompoundDirectoryDefault) CreateOutput(ctx context.Context, name string) (store.IndexOutput, error)
- func (*CompoundDirectoryDefault) CreateTempOutput(ctx context.Context, prefix, suffix string) (store.IndexOutput, error)
- func (*CompoundDirectoryDefault) DeleteFile(ctx context.Context, name string) error
- func (*CompoundDirectoryDefault) ObtainLock(name string) (store.Lock, error)
- func (*CompoundDirectoryDefault) Rename(ctx context.Context, source, dest string) error
- func (*CompoundDirectoryDefault) Sync(ctx context.Context, names []string) error
- func (*CompoundDirectoryDefault) SyncMetaData(ctx context.Context) error
- type CompoundFormat
- type ConcurrentMergeScheduler
- type DVFUIterator
- type DataFields
- type DataPostingsEnum
- func (d *DataPostingsEnum) Advance(target int) (int, error)
- func (d *DataPostingsEnum) Cost() int64
- func (d *DataPostingsEnum) DocID() int
- func (d *DataPostingsEnum) EndOffset() (int, error)
- func (d *DataPostingsEnum) Freq() (int, error)
- func (d *DataPostingsEnum) GetPayload() ([]byte, error)
- func (d *DataPostingsEnum) NextDoc() (int, error)
- func (d *DataPostingsEnum) NextPosition() (int, error)
- func (d *DataPostingsEnum) SlowAdvance(target int) (int, error)
- func (d *DataPostingsEnum) StartOffset() (int, error)
- type DataTerms
- func (d *DataTerms) GetDocCount() (int, error)
- func (d *DataTerms) GetSumDocFreq() (int64, error)
- func (d *DataTerms) GetSumTotalTermFreq() (int64, error)
- func (d *DataTerms) HasFreqs() bool
- func (d *DataTerms) HasOffsets() bool
- func (d *DataTerms) HasPayloads() bool
- func (d *DataTerms) HasPositions() bool
- func (d *DataTerms) Iterator() (TermsEnum, error)
- func (d *DataTerms) Size() (int, error)
- type DataTermsEnum
- func (d *DataTermsEnum) DocFreq() (int, error)
- func (d *DataTermsEnum) Impacts(flags int) (ImpactsEnum, error)
- func (d *DataTermsEnum) Next(context.Context) ([]byte, error)
- func (d *DataTermsEnum) Ord() (int64, error)
- func (d *DataTermsEnum) Postings(reuse PostingsEnum, flags int) (PostingsEnum, error)
- func (d *DataTermsEnum) SeekCeil(ctx context.Context, text []byte) (SeekStatus, error)
- func (d *DataTermsEnum) SeekExactByOrd(ctx context.Context, ord int64) error
- func (d *DataTermsEnum) Term() ([]byte, error)
- func (d *DataTermsEnum) TotalTermFreq() (int64, error)
- type DefaultIndexingChain
- func (d *DefaultIndexingChain) Abort() error
- func (d *DefaultIndexingChain) Flush(ctx context.Context, state *SegmentWriteState) (*DocMap, error)
- func (d *DefaultIndexingChain) GetHasDocValues(field string) types.DocIdSetIterator
- func (d *DefaultIndexingChain) NewPerField(indexCreatedVersionMajor int, fieldInfo *document.FieldInfo, invert bool, ...) (*PerField, error)
- func (d *DefaultIndexingChain) ProcessDocument(ctx context.Context, docId int, doc *document.Document) error
- type DeleteSlice
- type DirectoryReader
- type DirectoryReaderDefault
- type DocComparator
- type DocConsumer
- type DocIdSet
- type DocMap
- type DocValueSorter
- type DocValues
- type DocValuesConsumer
- type DocValuesFieldUpdates
- type DocValuesFieldUpdatesDefault
- func (d *DocValuesFieldUpdatesDefault) Any() bool
- func (d *DocValuesFieldUpdatesDefault) Field() string
- func (d *DocValuesFieldUpdatesDefault) Finish() error
- func (d *DocValuesFieldUpdatesDefault) GetFinished() bool
- func (d *DocValuesFieldUpdatesDefault) Grow(size int) error
- func (d *DocValuesFieldUpdatesDefault) Resize(size int) error
- func (d *DocValuesFieldUpdatesDefault) Size() int
- func (d *DocValuesFieldUpdatesDefault) Swap(i, j int) error
- type DocValuesFieldUpdatesIterator
- type DocValuesFormat
- type DocValuesLeafReader
- func (d *DocValuesLeafReader) CheckIntegrity() error
- func (d *DocValuesLeafReader) DoClose() error
- func (d *DocValuesLeafReader) DocumentV1(docID int, visitor document.StoredFieldVisitor) error
- func (d *DocValuesLeafReader) GetBinaryDocValues(field string) (BinaryDocValues, error)
- func (d *DocValuesLeafReader) GetFieldInfos() *FieldInfos
- func (d *DocValuesLeafReader) GetLiveDocs() util.Bits
- func (d *DocValuesLeafReader) GetMetaData() *LeafMetaData
- func (d *DocValuesLeafReader) GetNormValues(field string) (NumericDocValues, error)
- func (d *DocValuesLeafReader) GetNumericDocValues(field string) (NumericDocValues, error)
- func (d *DocValuesLeafReader) GetPointValues(field string) (types.PointValues, bool)
- func (d *DocValuesLeafReader) GetReaderCacheHelper() CacheHelper
- func (d *DocValuesLeafReader) GetSortedDocValues(field string) (SortedDocValues, error)
- func (d *DocValuesLeafReader) GetSortedNumericDocValues(field string) (SortedNumericDocValues, error)
- func (d *DocValuesLeafReader) GetSortedSetDocValues(field string) (SortedSetDocValues, error)
- func (d *DocValuesLeafReader) GetTermVectors(docID int) (Fields, error)
- func (d *DocValuesLeafReader) MaxDoc() int
- func (d *DocValuesLeafReader) NumDocs() int
- func (d *DocValuesLeafReader) Terms(field string) (Terms, error)
- type DocValuesProducer
- type DocValuesUpdate
- type DocValuesUpdateOptions
- type DocValuesUpdatesNode
- type DocValuesWriter
- type DocsWithFieldSet
- type DocumentsWriter
- type DocumentsWriterDeleteQueue
- type DocumentsWriterFlushControl
- type DocumentsWriterFlushQueue
- type DocumentsWriterPerThread
- type DocumentsWriterPerThreadPool
- type DoubleComparableProvider
- type DoubleDocComparator
- type DoubleSorter
- type EmptyDocComparator
- type EmptyDocValuesProducer
- func (e *EmptyDocValuesProducer) CheckIntegrity() error
- func (e *EmptyDocValuesProducer) Close() error
- func (e *EmptyDocValuesProducer) GetBinary(field *document.FieldInfo) (BinaryDocValues, error)
- func (e *EmptyDocValuesProducer) GetMergeInstance() DocValuesProducer
- func (e *EmptyDocValuesProducer) GetNumeric(field *document.FieldInfo) (NumericDocValues, error)
- func (e *EmptyDocValuesProducer) GetSorted(field *document.FieldInfo) (SortedDocValues, error)
- func (e *EmptyDocValuesProducer) GetSortedNumeric(field *document.FieldInfo) (SortedNumericDocValues, error)
- func (e *EmptyDocValuesProducer) GetSortedSet(field *document.FieldInfo) (SortedSetDocValues, error)
- type EmptyNumericDocValuesProvider
- type EmptySortedDocValuesProvider
- type Event
- type EventQueue
- type FieldComparator
- type FieldComparatorSource
- type FieldData
- type FieldDataList
- type FieldDimensions
- type FieldInfos
- func (f *FieldInfos) FieldInfo(fieldName string) *document.FieldInfo
- func (f *FieldInfos) FieldInfoByNumber(fieldNumber int) *document.FieldInfo
- func (f *FieldInfos) HasDocValues() bool
- func (f *FieldInfos) HasNorms() bool
- func (f *FieldInfos) HasPointValues() bool
- func (f *FieldInfos) HasVectors() bool
- func (f *FieldInfos) List() []*document.FieldInfo
- func (f *FieldInfos) Size() int
- type FieldInfosBuilder
- func (f *FieldInfosBuilder) Add(other *FieldInfos) error
- func (f *FieldInfosBuilder) AddFieldInfo(fi *document.FieldInfo) (*document.FieldInfo, error)
- func (f *FieldInfosBuilder) AddFieldInfoV(fi *document.FieldInfo, dvGen int64) (*document.FieldInfo, error)
- func (f *FieldInfosBuilder) Finish() *FieldInfos
- func (f *FieldInfosBuilder) GetOrAdd(name string) (*document.FieldInfo, error)
- type FieldInfosFormat
- type FieldInvertState
- func (f *FieldInvertState) GetAttributeSource() *attribute.Source
- func (f *FieldInvertState) GetIndexCreatedVersionMajor() int
- func (f *FieldInvertState) GetIndexOptions() document.IndexOptions
- func (f *FieldInvertState) GetLength() int
- func (f *FieldInvertState) GetMaxTermFrequency() int
- func (f *FieldInvertState) GetName() string
- func (f *FieldInvertState) GetNumOverlap() int
- func (f *FieldInvertState) GetOffset() int
- func (f *FieldInvertState) GetPosition() int
- func (f *FieldInvertState) GetUniqueTermCount() int
- func (f *FieldInvertState) Reset()
- func (f *FieldInvertState) SetAttributeSource(attributeSource *attribute.Source)
- func (f *FieldInvertState) SetLength(length int)
- func (f *FieldInvertState) SetNumOverlap(numOverlap int)
- type FieldNumbers
- type FieldTermIterator
- type FieldUpdatesBuffer
- type Fields
- type FieldsConsumer
- type FieldsConsumerDefault
- type FieldsConsumerExt
- type FieldsProducer
- type FilterLeafReader
- type FilteredTermsEnum
- type FilteredTermsEnumBase
- func (f *FilteredTermsEnumBase) Attributes() *attribute.Source
- func (f *FilteredTermsEnumBase) DocFreq() (int, error)
- func (f *FilteredTermsEnumBase) Impacts(flags int) (ImpactsEnum, error)
- func (f *FilteredTermsEnumBase) Next(context.Context) ([]byte, error)
- func (f *FilteredTermsEnumBase) Ord() (int64, error)
- func (f *FilteredTermsEnumBase) Postings(reuse PostingsEnum, flags int) (PostingsEnum, error)
- func (f *FilteredTermsEnumBase) SeekCeil(ctx context.Context, text []byte) (SeekStatus, error)
- func (f *FilteredTermsEnumBase) SeekExact(ctx context.Context, text []byte) (bool, error)
- func (f *FilteredTermsEnumBase) SeekExactByOrd(ctx context.Context, ord int64) error
- func (f *FilteredTermsEnumBase) SeekExactExpert(ctx context.Context, term []byte, state TermState) error
- func (f *FilteredTermsEnumBase) Term() ([]byte, error)
- func (f *FilteredTermsEnumBase) TermState() (TermState, error)
- func (f *FilteredTermsEnumBase) TotalTermFreq() (int64, error)
- type FilteredTermsEnumDefaultConfig
- type FindSegmentsFile
- type FinishedSegments
- type FloatComparableProvider
- type FloatDocComparator
- type FloatSorter
- type FlushNotifications
- type FlushPolicy
- type FlushTicket
- type FreqProxFields
- type FreqProxPostingsArray
- func (f *FreqProxPostingsArray) BytesPerPosting() int
- func (f *FreqProxPostingsArray) NewInstance() ParallelPostingsArray
- func (f *FreqProxPostingsArray) SetLastDocCodes(termID, v int)
- func (f *FreqProxPostingsArray) SetLastDocIDs(termID, v int)
- func (f *FreqProxPostingsArray) SetLastOffsets(termID, v int)
- func (f *FreqProxPostingsArray) SetLastPositions(termID, v int)
- func (f *FreqProxPostingsArray) SetTermFreqs(termID, v int)
- type FreqProxTerms
- func (f *FreqProxTerms) GetDocCount() (int, error)
- func (f *FreqProxTerms) GetMax() ([]byte, error)
- func (f *FreqProxTerms) GetMin() ([]byte, error)
- func (f *FreqProxTerms) GetSumDocFreq() (int64, error)
- func (f *FreqProxTerms) GetSumTotalTermFreq() (int64, error)
- func (f *FreqProxTerms) HasFreqs() bool
- func (f *FreqProxTerms) HasOffsets() bool
- func (f *FreqProxTerms) HasPayloads() bool
- func (f *FreqProxTerms) HasPositions() bool
- func (f *FreqProxTerms) Intersect(compiled *automaton.CompiledAutomaton, startTerm []byte) (TermsEnum, error)
- func (f *FreqProxTerms) Iterator() (TermsEnum, error)
- func (f *FreqProxTerms) Size() (int, error)
- type FreqProxTermsEnum
- func (f *FreqProxTermsEnum) DocFreq() (int, error)
- func (f *FreqProxTermsEnum) Impacts(flags int) (ImpactsEnum, error)
- func (f *FreqProxTermsEnum) Next(context.Context) ([]byte, error)
- func (f *FreqProxTermsEnum) Ord() (int64, error)
- func (f *FreqProxTermsEnum) Postings(reuse PostingsEnum, flags int) (PostingsEnum, error)
- func (f *FreqProxTermsEnum) SeekCeil(ctx context.Context, text []byte) (SeekStatus, error)
- func (f *FreqProxTermsEnum) SeekExactByOrd(ctx context.Context, ord int64) error
- func (f *FreqProxTermsEnum) Term() ([]byte, error)
- func (f *FreqProxTermsEnum) TotalTermFreq() (int64, error)
- type FreqProxTermsWriter
- func (f *FreqProxTermsWriter) AddField(invertState *FieldInvertState, fieldInfo *document.FieldInfo) (TermsHashPerField, error)
- func (f *FreqProxTermsWriter) Flush(fieldsToFlush map[string]TermsHashPerField, state *SegmentWriteState, ...) error
- func (f *FreqProxTermsWriter) SetTermBytePool(termBytePool *bytesref.BlockPool)
- type FreqProxTermsWriterPerField
- func (f *FreqProxTermsWriterPerField) AddTerm(termID, docID int) error
- func (f *FreqProxTermsWriterPerField) CreatePostingsArray(size int) ParallelPostingsArray
- func (f *FreqProxTermsWriterPerField) Finish() error
- func (f *FreqProxTermsWriterPerField) NewPostingsArray()
- func (f *FreqProxTermsWriterPerField) NewTerm(termID, docID int) error
- func (f *FreqProxTermsWriterPerField) Start(field document.IndexableField, first bool) bool
- type FreqProxTermsWriterPerFields
- type FrozenBufferedUpdates
- type Impact
- type Impacts
- type ImpactsEnum
- type ImpactsSource
- type IndexCommit
- type IndexCommits
- type IndexDeletionPolicy
- type IndexFileDeleter
- type IndexReaderContextDefault
- type IndexSorter
- type IndexingChain
- type IntComparableProvider
- type IntDocComparator
- type IntSorter
- type LeafAndDocID
- type LeafFieldComparator
- type LeafMetaData
- type LeafReader
- type LeafReaderBaseInner
- type LeafReaderContext
- type LiveDocsFormat
- type LiveIndexWriterConfig
- type LogByteSizeMergePolicy
- type LongComparableProvider
- type LongDocComparator
- type LongSorter
- type MergeContext
- type MergePolicy
- type MergePolicyBase
- func (m *MergePolicyBase) FindFullFlushMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, ...) (*MergeSpecification, error)
- func (m *MergePolicyBase) KeepFullyDeletedSegment(func() CodecReader) bool
- func (m *MergePolicyBase) UseCompoundFile(infos *SegmentInfos, mergedInfo *SegmentCommitInfo, mergeContext MergeContext) (bool, error)
- type MergePolicyInner
- type MergeScheduler
- type MergeSource
- type MergeSpecification
- type MergeState
- type MergeStateDocMap
- type MergeTrigger
- type Merges
- type MultiLevelSkipListReader
- type MultiLevelSkipListReaderDefault
- func (m *MultiLevelSkipListReaderDefault) Close() error
- func (m *MultiLevelSkipListReaderDefault) GetDoc() int
- func (m *MultiLevelSkipListReaderDefault) GetSkipDoc(idx int) int
- func (m *MultiLevelSkipListReaderDefault) Init(skipPointer int64, df int) error
- func (m *MultiLevelSkipListReaderDefault) MaxNumberOfSkipLevels() int
- func (m *MultiLevelSkipListReaderDefault) SkipTo(target int) (int, error)
- type MultiLevelSkipListWriter
- type MultiLevelSkipListWriterDefault
- type MultiLevelSkipListWriterDefaultConfig
- type NamedSPI
- type NoMergePolicy
- func (n *NoMergePolicy) FindForcedDeletesMerges(segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
- func (n *NoMergePolicy) FindForcedMerges(segmentInfos *SegmentInfos, maxSegmentCount int, ...) (*MergeSpecification, error)
- func (n *NoMergePolicy) FindFullFlushMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, ...) (*MergeSpecification, error)
- func (n *NoMergePolicy) FindMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, ...) (*MergeSpecification, error)
- func (n *NoMergePolicy) GetNoCFSRatio() float64
- func (n *NoMergePolicy) Size(info *SegmentCommitInfo, mergeContext MergeContext) (int64, error)
- func (n *NoMergePolicy) UseCompoundFile(infos *SegmentInfos, newSegment *SegmentCommitInfo, mergeContext MergeContext) (bool, error)
- type Node
- type NodeApply
- type NormValuesWriter
- type NormsConsumer
- type NormsConsumerDefault
- type NormsFormat
- type NormsProducer
- type NumericDVs
- type NumericDocValues
- type NumericDocValuesDefault
- func (n *NumericDocValuesDefault) Advance(target int) (int, error)
- func (n *NumericDocValuesDefault) AdvanceExact(target int) (bool, error)
- func (n *NumericDocValuesDefault) Cost() int64
- func (n *NumericDocValuesDefault) DocID() int
- func (n *NumericDocValuesDefault) LongValue() (int64, error)
- func (n *NumericDocValuesDefault) NextDoc() (int, error)
- func (n *NumericDocValuesDefault) SlowAdvance(target int) (int, error)
- type NumericDocValuesProvider
- type NumericDocValuesSub
- type NumericDocValuesUpdate
- func (n *NumericDocValuesUpdate) GetDocValuesType() document.DocValuesType
- func (n *NumericDocValuesUpdate) GetOptions() *DocValuesUpdateOptions
- func (n *NumericDocValuesUpdate) HasValue() bool
- func (n *NumericDocValuesUpdate) ValueSizeInBytes() int64
- func (n *NumericDocValuesUpdate) ValueToString() string
- func (n *NumericDocValuesUpdate) WriteTo(output store.DataOutput) error
- type NumericDocValuesWriter
- type OneMerge
- type OneMergeProgress
- type OpenMode
- type OrdTermState
- type OrdinalMap
- type PagedBytes
- func (r *PagedBytes) CloneWithoutBlocks() *PagedBytes
- func (r *PagedBytes) CopyV1(in store.IndexInput, byteCount int) error
- func (r *PagedBytes) CopyV2(bytes []byte, out *bytes.Buffer) error
- func (r *PagedBytes) Freeze(trim bool) (*PagedBytesReader, error)
- func (r *PagedBytes) GetDataInput() *PagedBytesDataInput
- func (r *PagedBytes) GetDataOutput() *PagedBytesDataOutput
- func (r *PagedBytes) GetPointer() int64
- type PagedBytesDataInput
- type PagedBytesDataOutput
- type PagedBytesReader
- type ParallelPostingsArray
- type ParallelPostingsArrayDefault
- func (p *ParallelPostingsArrayDefault) AddressOffset() []int
- func (p *ParallelPostingsArrayDefault) ByteStarts() []int
- func (p *ParallelPostingsArrayDefault) GetAddressOffset(index int) int
- func (p *ParallelPostingsArrayDefault) GetByteStarts(index int) int
- func (p *ParallelPostingsArrayDefault) GetTextStarts(index int) int
- func (p *ParallelPostingsArrayDefault) Grow()
- func (p *ParallelPostingsArrayDefault) SetAddressOffset(termID, v int)
- func (p *ParallelPostingsArrayDefault) SetByteStarts(termID, v int)
- func (p *ParallelPostingsArrayDefault) SetTextStarts(termID, v int)
- func (p *ParallelPostingsArrayDefault) TextStarts() []uint32
- type PauseReason
- type PendingDeletes
- type PendingDeletesDefault
- func (p *PendingDeletesDefault) Delete(docID int) (bool, error)
- func (p *PendingDeletesDefault) DropChanges()
- func (p *PendingDeletesDefault) GetDelCount() int
- func (p *PendingDeletesDefault) GetHardLiveDocs() util.Bits
- func (p *PendingDeletesDefault) GetLiveDocs() util.Bits
- func (p *PendingDeletesDefault) GetMutableBits() *bitset.BitSet
- func (p *PendingDeletesDefault) IsFullyDeleted(readerIOSupplier func() CodecReader) (bool, error)
- func (p *PendingDeletesDefault) NumPendingDeletes() int
- func (p *PendingDeletesDefault) OnDocValuesUpdate(info *document.FieldInfo, iterator DocValuesFieldUpdatesIterator)
- func (p *PendingDeletesDefault) OnNewReader(reader CodecReader, info *SegmentCommitInfo) error
- func (p *PendingDeletesDefault) WriteLiveDocs(dir store.Directory) (bool, error)
- type PendingSoftDeletes
- func (p *PendingSoftDeletes) Delete(docID int) (bool, error)
- func (p *PendingSoftDeletes) DropChanges()
- func (p *PendingSoftDeletes) GetDelCount() int
- func (p *PendingSoftDeletes) GetHardLiveDocs() util.Bits
- func (p *PendingSoftDeletes) GetLiveDocs() util.Bits
- func (p *PendingSoftDeletes) GetMutableBits() *bitset.BitSet
- func (p *PendingSoftDeletes) IsFullyDeleted(readerIOSupplier func() CodecReader) (bool, error)
- func (p *PendingSoftDeletes) NumPendingDeletes() int
- func (p *PendingSoftDeletes) OnDocValuesUpdate(info *document.FieldInfo, iterator DocValuesFieldUpdatesIterator)
- func (p *PendingSoftDeletes) OnNewReader(reader CodecReader, info *SegmentCommitInfo) error
- func (p *PendingSoftDeletes) WriteLiveDocs(dir store.Directory) (bool, error)
- type PerField
- type PointValuesWriter
- type PointsFormat
- type PointsReader
- type PointsWriter
- type PositionData
- type PostingsBytesStartArray
- type PostingsEnum
- type PostingsFormat
- type PrefixCodedTerms
- type Reader
- type ReaderBase
- func (r *ReaderBase) Close() error
- func (r *ReaderBase) DecRef() error
- func (r *ReaderBase) Document(docID int) (*document.Document, error)
- func (r *ReaderBase) DocumentV2(docID int, fieldsToLoad map[string]struct{}) (*document.Document, error)
- func (r *ReaderBase) GetRefCount() int
- func (r *ReaderBase) GetTermVector(docID int, field string) (Terms, error)
- func (r *ReaderBase) HasDeletions() bool
- func (r *ReaderBase) IncRef() error
- func (r *ReaderBase) Leaves() ([]*LeafReaderContext, error)
- func (r *ReaderBase) NotifyReaderClosedListeners() error
- func (r *ReaderBase) NumDeletedDocs() int
- func (r *ReaderBase) RegisterParentReader(reader Reader)
- func (r *ReaderBase) TryIncRef() bool
- type ReaderCommit
- func (r *ReaderCommit) CompareTo(commit IndexCommit) int
- func (r *ReaderCommit) Delete() error
- func (r *ReaderCommit) GetDirectory() store.Directory
- func (r *ReaderCommit) GetFileNames() (map[string]struct{}, error)
- func (r *ReaderCommit) GetGeneration() int64
- func (r *ReaderCommit) GetReader() *StandardDirectoryReader
- func (r *ReaderCommit) GetSegmentCount() int
- func (r *ReaderCommit) GetSegmentsFileName() string
- func (r *ReaderCommit) GetUserData() (map[string]string, error)
- func (r *ReaderCommit) IsDeleted() bool
- type ReaderContext
- type ReaderPool
- type ReaderSPI
- type ReaderSorter
- type ReaderWarmer
- type ReadersAndUpdates
- func (r *ReadersAndUpdates) AddDVUpdate(update DocValuesFieldUpdates) error
- func (r *ReadersAndUpdates) DecRef()
- func (r *ReadersAndUpdates) GetDelCount() int
- func (r *ReadersAndUpdates) GetNumDVUpdates() int
- func (r *ReadersAndUpdates) GetReader(context *store.IOContext) (*SegmentReader, error)
- func (r *ReadersAndUpdates) IncRef()
- func (r *ReadersAndUpdates) RefCount() int64
- type RefCount
- type Scorable
- type SeekStatus
- type SegmentCommitInfo
- func (s *SegmentCommitInfo) Clone() *SegmentCommitInfo
- func (s *SegmentCommitInfo) Files() (map[string]struct{}, error)
- func (s *SegmentCommitInfo) GetDelCount() int
- func (s *SegmentCommitInfo) GetDelCountV1(includeSoftDeletes bool) int
- func (s *SegmentCommitInfo) GetDelGen() int64
- func (s *SegmentCommitInfo) GetDocValuesGen() int64
- func (s *SegmentCommitInfo) GetFieldInfosGen() int64
- func (s *SegmentCommitInfo) GetId() []byte
- func (s *SegmentCommitInfo) GetNextDelGen() int64
- func (s *SegmentCommitInfo) GetNextDocValuesGen() int64
- func (s *SegmentCommitInfo) GetNextFieldInfosGen() int64
- func (s *SegmentCommitInfo) GetNextWriteDelGen() int64
- func (s *SegmentCommitInfo) GetNextWriteDocValuesGen() int64
- func (s *SegmentCommitInfo) GetNextWriteFieldInfosGen() int64
- func (s *SegmentCommitInfo) GetSoftDelCount() int
- func (s *SegmentCommitInfo) HasDeletions() bool
- func (s *SegmentCommitInfo) HasFieldUpdates() bool
- func (s *SegmentCommitInfo) Info() *SegmentInfo
- func (s *SegmentCommitInfo) SetDelCount(delCount int)
- func (s *SegmentCommitInfo) SetDocValuesUpdatesFiles(files map[int]map[string]struct{})
- func (s *SegmentCommitInfo) SetFieldInfosFiles(fieldInfosFiles map[string]struct{})
- func (s *SegmentCommitInfo) SetNextWriteDelGen(v int64)
- func (s *SegmentCommitInfo) SetNextWriteDocValuesGen(v int64)
- func (s *SegmentCommitInfo) SetNextWriteFieldInfosGen(v int64)
- func (s *SegmentCommitInfo) SetSoftDelCount(softDelCount int)
- func (s *SegmentCommitInfo) SizeInBytes() (int64, error)
- type SegmentCoreReaders
- type SegmentDocValues
- type SegmentDocValuesProducer
- func (s *SegmentDocValuesProducer) CheckIntegrity() error
- func (s *SegmentDocValuesProducer) Close() error
- func (s *SegmentDocValuesProducer) GetBinary(field *document.FieldInfo) (BinaryDocValues, error)
- func (s *SegmentDocValuesProducer) GetMergeInstance() DocValuesProducer
- func (s *SegmentDocValuesProducer) GetNumeric(field *document.FieldInfo) (NumericDocValues, error)
- func (s *SegmentDocValuesProducer) GetSorted(field *document.FieldInfo) (SortedDocValues, error)
- func (s *SegmentDocValuesProducer) GetSortedNumeric(field *document.FieldInfo) (SortedNumericDocValues, error)
- func (s *SegmentDocValuesProducer) GetSortedSet(field *document.FieldInfo) (SortedSetDocValues, error)
- type SegmentInfo
- func (s *SegmentInfo) AddFile(file string) error
- func (s *SegmentInfo) Dir() store.Directory
- func (s *SegmentInfo) Files() map[string]struct{}
- func (s *SegmentInfo) GetAttributes() map[string]string
- func (s *SegmentInfo) GetCodec() Codec
- func (s *SegmentInfo) GetDiagnostics() map[string]string
- func (s *SegmentInfo) GetID() []byte
- func (s *SegmentInfo) GetIndexSort() *Sort
- func (s *SegmentInfo) GetMinVersion() *version.Version
- func (s *SegmentInfo) GetUseCompoundFile() bool
- func (s *SegmentInfo) GetVersion() *version.Version
- func (s *SegmentInfo) MaxDoc() (int, error)
- func (s *SegmentInfo) Name() string
- func (s *SegmentInfo) NamedForThisSegment(file string) string
- func (s *SegmentInfo) PutAttribute(key, value string) string
- func (s *SegmentInfo) SetCodec(codec Codec)
- func (s *SegmentInfo) SetDiagnostics(diagnostics map[string]string)
- func (s *SegmentInfo) SetFiles(files map[string]struct{})
- func (s *SegmentInfo) SetMaxDoc(maxDoc int) error
- func (s *SegmentInfo) SetUseCompoundFile(isCompoundFile bool)
- type SegmentInfoFormat
- type SegmentInfos
- func NewSegmentInfos(indexCreatedVersionMajor int) *SegmentInfos
- func ReadCommit(ctx context.Context, directory store.Directory, segmentFileName string) (*SegmentInfos, error)
- func ReadCommitFromChecksum(ctx context.Context, directory store.Directory, input store.ChecksumIndexInput, ...) (*SegmentInfos, error)
- func ReadLatestCommit(ctx context.Context, directory store.Directory) (*SegmentInfos, error)
- func (i *SegmentInfos) Add(si *SegmentCommitInfo) error
- func (i *SegmentInfos) AddAll(sis []*SegmentCommitInfo)
- func (i *SegmentInfos) AsList() []*SegmentCommitInfo
- func (i *SegmentInfos) Changed()
- func (i *SegmentInfos) Clone() *SegmentInfos
- func (i *SegmentInfos) CreateBackupSegmentInfos() []*SegmentCommitInfo
- func (i *SegmentInfos) Files(includeSegmentsFile bool) (map[string]struct{}, error)
- func (i *SegmentInfos) GetGeneration() int64
- func (i *SegmentInfos) GetLastGeneration() int64
- func (i *SegmentInfos) GetSegmentsFileName() string
- func (i *SegmentInfos) GetUserData() map[string]string
- func (i *SegmentInfos) GetVersion() int64
- func (i *SegmentInfos) Info(j int) *SegmentCommitInfo
- func (i *SegmentInfos) Remove(index int)
- func (i *SegmentInfos) Replace(other *SegmentInfos)
- func (i *SegmentInfos) SetNextWriteGeneration(generation int64)
- func (i *SegmentInfos) Size() int
- func (i *SegmentInfos) TotalMaxDoc() int64
- func (i *SegmentInfos) UpdateGeneration(other *SegmentInfos)
- func (i *SegmentInfos) UpdateGenerationVersionAndCounter(other *SegmentInfos)
- type SegmentMap
- type SegmentMerger
- type SegmentReadState
- type SegmentReader
- func (s *SegmentReader) Directory() store.Directory
- func (s *SegmentReader) DoClose() error
- func (s *SegmentReader) GetDocValuesReader() DocValuesProducer
- func (s *SegmentReader) GetFieldInfos() *FieldInfos
- func (s *SegmentReader) GetFieldsReader() StoredFieldsReader
- func (s *SegmentReader) GetHardLiveDocs() util.Bits
- func (s *SegmentReader) GetLiveDocs() util.Bits
- func (s *SegmentReader) GetMetaData() *LeafMetaData
- func (s *SegmentReader) GetNormsReader() NormsProducer
- func (s *SegmentReader) GetOriginalSegmentInfo() *SegmentCommitInfo
- func (s *SegmentReader) GetPointsReader() PointsReader
- func (s *SegmentReader) GetPostingsReader() FieldsProducer
- func (s *SegmentReader) GetReaderCacheHelper() CacheHelper
- func (s *SegmentReader) GetTermVectorsReader() TermVectorsReader
- func (s *SegmentReader) MaxDoc() int
- func (s *SegmentReader) NumDocs() int
- type SegmentWriteState
- type SimScorer
- type SimScorerDefault
- type SimScorerSPI
- type Similarity
- type SingleTermsEnum
- type SingleValueDocValuesFieldUpdates
- type SkipBuffer
- func (s *SkipBuffer) Clone() store.CloneReader
- func (s *SkipBuffer) Close() error
- func (s *SkipBuffer) GetFilePointer() int64
- func (s *SkipBuffer) Length() int64
- func (s *SkipBuffer) Read(b []byte) (int, error)
- func (s *SkipBuffer) ReadByte() (byte, error)
- func (s *SkipBuffer) Seek(pos int64, whence int) (int64, error)
- func (s *SkipBuffer) Slice(sliceDescription string, offset, length int64) (store.IndexInput, error)
- type SlowImpactsEnum
- func (s *SlowImpactsEnum) Advance(target int) (int, error)
- func (s *SlowImpactsEnum) AdvanceShallow(target int) error
- func (s *SlowImpactsEnum) Cost() int64
- func (s *SlowImpactsEnum) DocID() int
- func (s *SlowImpactsEnum) EndOffset() (int, error)
- func (s *SlowImpactsEnum) Freq() (int, error)
- func (s *SlowImpactsEnum) GetImpacts() (Impacts, error)
- func (s *SlowImpactsEnum) GetPayload() ([]byte, error)
- func (s *SlowImpactsEnum) NextDoc() (int, error)
- func (s *SlowImpactsEnum) NextPosition() (int, error)
- func (s *SlowImpactsEnum) SlowAdvance(target int) (int, error)
- func (s *SlowImpactsEnum) StartOffset() (int, error)
- type Sort
- type SortField
- type SortFieldProvider
- type SortFieldType
- type SortedDocValues
- type SortedDocValuesDefaultConfig
- type SortedDocValuesProvider
- type SortedDocValuesTermsEnum
- func (s *SortedDocValuesTermsEnum) Attributes() *attribute.Source
- func (s *SortedDocValuesTermsEnum) DocFreq() (int, error)
- func (s *SortedDocValuesTermsEnum) Impacts(flags int) (ImpactsEnum, error)
- func (s *SortedDocValuesTermsEnum) Next(context.Context) ([]byte, error)
- func (s *SortedDocValuesTermsEnum) Ord() (int64, error)
- func (s *SortedDocValuesTermsEnum) Postings(reuse PostingsEnum, flags int) (PostingsEnum, error)
- func (s *SortedDocValuesTermsEnum) SeekCeil(ctx context.Context, text []byte) (SeekStatus, error)
- func (s *SortedDocValuesTermsEnum) SeekExact(ctx context.Context, text []byte) (bool, error)
- func (s *SortedDocValuesTermsEnum) SeekExactByOrd(ctx context.Context, ord int64) error
- func (s *SortedDocValuesTermsEnum) SeekExactExpert(ctx context.Context, term []byte, state TermState) error
- func (s *SortedDocValuesTermsEnum) Term() ([]byte, error)
- func (s *SortedDocValuesTermsEnum) TermState() (TermState, error)
- func (s *SortedDocValuesTermsEnum) TotalTermFreq() (int64, error)
- type SortedDocValuesWriter
- type SortedNumericDocValues
- type SortedNumericDocValuesWriter
- type SortedSetDocValues
- type SortedSetDocValuesWriter
- type SortedSetSelector
- type SortedSetSelectorType
- type SortedSetSortField
- type SortedSetSortFieldProvider
- type Sorter
- type SorterDefault
- type SortingNumericDocValues
- func (s *SortingNumericDocValues) Advance(target int) (int, error)
- func (s *SortingNumericDocValues) AdvanceExact(target int) (bool, error)
- func (s *SortingNumericDocValues) Cost() int64
- func (s *SortingNumericDocValues) DocID() int
- func (s *SortingNumericDocValues) LongValue() (int64, error)
- func (s *SortingNumericDocValues) NextDoc() (int, error)
- func (s *SortingNumericDocValues) SlowAdvance(target int) (int, error)
- type StandardDirectoryReader
- type StoredFieldsConsumer
- type StoredFieldsFormat
- type StoredFieldsReader
- type StoredFieldsWriter
- type StringDocComparator
- type StringSorter
- type Term
- type TermData
- type TermDataList
- type TermNode
- type TermState
- type TermStates
- func (r *TermStates) AccumulateStatistics(docFreq int, totalTermFreq int64)
- func (r *TermStates) DocFreq() (int, error)
- func (r *TermStates) Get(ctx *LeafReaderContext) (TermState, error)
- func (r *TermStates) Register(state TermState, ord, docFreq int, totalTermFreq int64)
- func (r *TermStates) Register2(state TermState, ord int)
- func (r *TermStates) TotalTermFreq() (int64, error)
- func (r *TermStates) WasBuiltFor(context ReaderContext) bool
- type TermVectorsConsumer
- func (t *TermVectorsConsumer) AddField(invertState *FieldInvertState, fieldInfo *document.FieldInfo) (TermsHashPerField, error)
- func (t *TermVectorsConsumer) FinishDocument(docID int) error
- func (t *TermVectorsConsumer) Flush(fieldsToFlush map[string]TermsHashPerField, state *SegmentWriteState, ...) error
- func (t *TermVectorsConsumer) SetTermBytePool(termBytePool *bytesref.BlockPool)
- type TermVectorsConsumerPerField
- func (t *TermVectorsConsumerPerField) AddTerm(termID, docID int) error
- func (t *TermVectorsConsumerPerField) CreatePostingsArray(size int) ParallelPostingsArray
- func (t *TermVectorsConsumerPerField) Finish() error
- func (t *TermVectorsConsumerPerField) FinishDocument() error
- func (t *TermVectorsConsumerPerField) NewPostingsArray()
- func (t *TermVectorsConsumerPerField) NewTerm(termID, docID int) error
- func (t *TermVectorsConsumerPerField) Reset() error
- func (t *TermVectorsConsumerPerField) Start(field document.IndexableField, first bool) bool
- type TermVectorsConsumerPerFields
- type TermVectorsFormat
- type TermVectorsPostingsArray
- func (t *TermVectorsPostingsArray) BytesPerPosting() int
- func (t *TermVectorsPostingsArray) Grow()
- func (t *TermVectorsPostingsArray) NewInstance() ParallelPostingsArray
- func (t *TermVectorsPostingsArray) SetFreqs(termID, v int)
- func (t *TermVectorsPostingsArray) SetLastOffsets(termID, v int)
- func (t *TermVectorsPostingsArray) SetLastPositions(termID, v int)
- type TermVectorsReader
- type TermVectorsWriter
- type Terms
- type TermsBase
- type TermsEnum
- type TermsEnumIndex
- type TermsHash
- type TermsHashPerField
- type TermsHashPerFieldDefault
- func (t *TermsHashPerFieldDefault) Add(termBytes []byte, docID int) error
- func (t *TermsHashPerFieldDefault) Add2nd(textStart, docID int) error
- func (t *TermsHashPerFieldDefault) Finish() error
- func (t *TermsHashPerFieldDefault) GetNextPerField() TermsHashPerField
- func (t *TermsHashPerFieldDefault) GetPostingsArray() ParallelPostingsArray
- func (t *TermsHashPerFieldDefault) Reset() error
- func (t *TermsHashPerFieldDefault) SetPostingsArray(v ParallelPostingsArray)
- func (t *TermsHashPerFieldDefault) Start(field document.IndexableField, first bool) bool
- type TermsSPI
- type TieredMergePolicy
- func (t *TieredMergePolicy) FindForcedDeletesMerges(segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
- func (t *TieredMergePolicy) FindForcedMerges(segmentInfos *SegmentInfos, maxSegmentCount int, ...) (*MergeSpecification, error)
- func (t *TieredMergePolicy) FindFullFlushMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, ...) (*MergeSpecification, error)
- func (t *TieredMergePolicy) FindMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, ...) (*MergeSpecification, error)
- func (t *TieredMergePolicy) GetNoCFSRatio() float64
- func (t *TieredMergePolicy) Size(info *SegmentCommitInfo, mergeContext MergeContext) (int64, error)
- func (t *TieredMergePolicy) UseCompoundFile(infos *SegmentInfos, mergedInfo *SegmentCommitInfo, mergeContext MergeContext) (bool, error)
- type Writer
- func (w *Writer) AddDocument(ctx context.Context, doc *document.Document) (int64, error)
- func (w *Writer) AddIndexesFromReaders(readers ...CodecReader) (int64, error)
- func (w *Writer) Changed()
- func (w *Writer) Close() error
- func (w *Writer) Commit(ctx context.Context) error
- func (w *Writer) GetConfig() *WriterConfig
- func (w *Writer) GetDirectory() store.Directory
- func (w *Writer) GetReader(applyAllDeletes bool, writeAllDeletes bool) (DirectoryReader, error)
- func (w *Writer) IncRefDeleter(segmentInfos *SegmentInfos) error
- func (w *Writer) IsClosed() bool
- func (w *Writer) MaybeMerge() error
- func (w *Writer) Release(readersAndUpdates *ReadersAndUpdates) error
- func (w *Writer) SoftUpdateDocument(ctx context.Context, term *Term, doc *document.Document, ...) (int64, error)
- func (w *Writer) UpdateDocument(ctx context.Context, term *Term, doc *document.Document) (int64, error)
- type WriterConfig
- func (r WriterConfig) GetAnalyzer() analysis.Analyzer
- func (r WriterConfig) GetCodec() Codec
- func (c *WriterConfig) GetCommitOnClose() bool
- func (c *WriterConfig) GetFlushPolicy() FlushPolicy
- func (c *WriterConfig) GetIndexCommit() IndexCommit
- func (c *WriterConfig) GetIndexCreatedVersionMajor() int
- func (r WriterConfig) GetIndexDeletionPolicy() IndexDeletionPolicy
- func (r WriterConfig) GetIndexSort() *Sort
- func (r WriterConfig) GetIndexSortFields() map[string]struct{}
- func (r WriterConfig) GetIndexingChain() IndexingChain
- func (r WriterConfig) GetLeafSorter() func(a, b LeafReader) int
- func (r WriterConfig) GetMaxBufferedDocs() int
- func (r WriterConfig) GetMaxFullFlushMergeWaitMillis() int64
- func (r WriterConfig) GetMergePolicy() MergePolicy
- func (c *WriterConfig) GetMergeScheduler() MergeScheduler
- func (r WriterConfig) GetMergedSegmentWarmer() ReaderWarmer
- func (c *WriterConfig) GetOpenMode() OpenMode
- func (r WriterConfig) GetReaderPooling() bool
- func (r WriterConfig) GetSimilarity() Similarity
- func (r WriterConfig) GetSoftDeletesField() string
- func (r WriterConfig) GetUseCompoundFile() bool
- func (r WriterConfig) IsCheckPendingFlushOnUpdate() bool
- func (r WriterConfig) SetCheckPendingFlushUpdate(checkPendingFlushOnUpdate bool)
- func (c *WriterConfig) SetIndexSort(sort *Sort) error
- func (r WriterConfig) SetMaxBufferedDocs(maxBufferedDocs int)
- func (r WriterConfig) SetMergePolicy(mergePolicy MergePolicy)
- func (r WriterConfig) SetMergedSegmentWarmer(mergeSegmentWarmer ReaderWarmer)
- func (r WriterConfig) SetUseCompoundFile(useCompoundFile bool)
Constants ¶
const ( HAS_VALUE_MASK = 1 HAS_NO_VALUE_MASK = 0 SHIFT = 1 )
const ( // ACCEPT_STATUS_YES Accept the term and position the enum at the next term. ACCEPT_STATUS_YES = AcceptStatus(iota) // ACCEPT_STATUS_YES_AND_SEEK Accept the term and advance (nextSeekTerm(BytesRef)) to the next term. ACCEPT_STATUS_YES_AND_SEEK // ACCEPT_STATUS_NO Reject the term and position the enum at the next term. ACCEPT_STATUS_NO // ACCEPT_STATUS_NO_AND_SEEK Reject the term and advance (nextSeekTerm(BytesRef)) to the next term. ACCEPT_STATUS_NO_AND_SEEK // ACCEPT_STATUS_END Reject the term and stop enumerating. ACCEPT_STATUS_END )
const ( // SEGMENTS Name of the index segment file SEGMENTS = "segments" // PENDING_SEGMENTS Name of pending index segment file PENDING_SEGMENTS = "pending_segments" // OLD_SEGMENTS_GEN Name of the generation reference file name OLD_SEGMENTS_GEN = "segments.gen" )
const ( // CREATE Creates a new index or overwrites an existing one. CREATE = OpenMode(iota) // APPEND Opens an existing index. APPEND // CREATE_OR_APPEND Creates a new index if one does not exist, // otherwise it opens the index and documents will be appended. CREATE_OR_APPEND )
const ( DEFAULT_NO_CFS_RATIO = 1.0 DEFAULT_MAX_CFS_SEGMENT_SIZE = math.MaxInt64 )
const ( STOPPED = PauseReason(iota) // Stopped (because of throughput rate set to 0, typically). PAUSED // Temporarily paused because of exceeded throughput rate. OTHER // Other reason. )
const ( // SEGMENT_FLUSH // Merge was triggered by a segment Flush. // 由一个段的flush来触发的 SEGMENT_FLUSH = MergeTrigger(iota) // FULL_FLUSH // Merge was triggered by a full Flush. Full flushes can be caused by a commit, // NRT reader reopen or a close call on the index writer. FULL_FLUSH // EXPLICIT Merge has been triggered explicitly by the user. EXPLICIT // MERGE_FINISHED Merge was triggered by a successfully finished merge. MERGE_FINISHED // CLOSING Merge was triggered by a closing IndexWriter. CLOSING // COMMIT Merge was triggered on commit. COMMIT // GET_READER Merge was triggered on opening NRT readers. GET_READER )
const ( POSTINGS_ENUM_NONE = 0 POSTINGS_ENUM_FREQS = 1 << 3 POSTINGS_ENUM_POSITIONS = POSTINGS_ENUM_FREQS | 1<<4 POSTINGS_ENUM_OFFSETS = POSTINGS_ENUM_POSITIONS | 1<<5 POSTINGS_ENUM_PAYLOADS = POSTINGS_ENUM_POSITIONS | 1<<6 POSTINGS_ENUM_ALL = POSTINGS_ENUM_OFFSETS | POSTINGS_ENUM_PAYLOADS )
const ( // SegmentInfoNO Used by some member fields to mean not present (e.g., norms, deletions). // e.g. no norms; no deletes; SegmentInfoNO = -1 // SegmentInfoYES Used by some member fields to mean present (e.g., norms, deletions). // e.g. have norms; have deletes; SegmentInfoYES = 1 )
const ( // VERSION_70 The version that added information about the Lucene version at the time when the index has been created. VERSION_70 = 7 // VERSION_72 The version that updated segment name counter to be long instead of int. VERSION_72 = 8 // VERSION_74 The version that recorded softDelCount VERSION_74 = 9 // VERSION_86 The version that recorded SegmentCommitInfo IDs VERSION_86 = 10 VERSION_CURRENT = VERSION_86 )
const ( MIN = SortedSetSelectorType(iota) // Selects the minimum item in the set MAX // Selects the maximum item in the set MIDDLE_MIN // Selects the middle item in the set. If the set has an even number of values, the lower of the middle two is chosen. MIDDLE_MAX // Selects the middle item in the set. If the set has an even number of values, the higher of the middle two is chosen )
const ( BINARY_SORT_THRESHOLD = 20 INSERTION_SORT_THRESHOLD = 16 )
const ( STRING_FIRST = "SortField.STRING_FIRST" STRING_LAST = "SortField.STRING_LAST" )
const ( // SCORE // Sort by document score (relevance). // Sort values are Float and higher values are at the front. SCORE = SortFieldType(iota) // DOC Sort by document number (index order). // Sort values are Integer and lower values are at the front. DOC // STRING Sort using term values as Strings. // Sort values are String and lower values are at the front. STRING // INT Sort using term values as encoded Integers. // Sort values are Integer and lower values are at the front. INT // FLOAT Sort using term values as encoded Floats. // Sort values are Float and lower values are at the front. FLOAT // LONG Sort using term values as encoded Longs. // Sort values are Long and lower values are at the front. LONG // DOUBLE Sort using term values as encoded Doubles. // Sort values are Double and lower values are at the front. DOUBLE // CUSTOM Sort using a custom cmp. // Sort values are any Comparable and sorting is done according to natural order. CUSTOM // STRING_VAL Sort using term values as Strings, // but comparing by item (using String.compareTo) for all comparisons. // This is typically slower than STRING, which uses ordinals to do the sorting. STRING_VAL // REWRITEABLE Force rewriting of SortField using rewrite(IndexSearcher) before it can be used for sorting REWRITEABLE )
const ( // SEEK_STATUS_END The term was not found, and the end of iteration was hit. SEEK_STATUS_END = iota // SEEK_STATUS_FOUND The precise term was found. SEEK_STATUS_FOUND // SEEK_STATUS_NOT_FOUND A different term was found after the requested term SEEK_STATUS_NOT_FOUND )
const ( // MAX_DOCS Hard limit on maximum number of documents that may be added to the index. // If you try to add more than this you'll hit IllegalArgumentException MAX_DOCS = math.MaxInt32 - 128 // MAX_POSITION Maximum item of the token position in an indexed field. MAX_POSITION = math.MaxInt32 - 128 UNBOUNDED_MAX_MERGE_SEGMENTS = -1 // WRITE_LOCK_NAME Name of the write lock in the index. WRITE_LOCK_NAME = "write.lock" // SOURCE key for the source of a segment in the diagnostics. SOURCE = "source" // SOURCE_MERGE Source of a segment which results from a merge of other segments. SOURCE_MERGE = "merge" // SOURCE_FLUSH Source of a segment which results from a Flush. SOURCE_FLUSH = "Flush" // SOURCE_ADDINDEXES_READERS Source of a segment which results from a call to addIndexes(CodecReader...). SOURCE_ADDINDEXES_READERS = "addIndexes(CodecReader...)" BYTE_BLOCK_SHIFT = 15 BYTE_BLOCK_SIZE = 1 << BYTE_BLOCK_SHIFT // MAX_TERM_LENGTH Absolute hard maximum length for a term, in bytes once encoded as UTF8. // If a term arrives from the analyzer longer than this length, an IllegalArgumentException // is thrown and a message is printed to infoStream, if set (see IndexWriterConfig.setInfoStream(InfoStream)). MAX_TERM_LENGTH = BYTE_BLOCK_SIZE - 2 MAX_STORED_STRING_LENGTH = math.MaxInt )
const ( // DISABLE_AUTO_FLUSH Denotes a Flush trigger is disabled. DISABLE_AUTO_FLUSH = -1 // DEFAULT_MAX_BUFFERED_DELETE_TERMS Disabled by default (because IndexWriter flushes by RAM usage by default). DEFAULT_MAX_BUFFERED_DELETE_TERMS = DISABLE_AUTO_FLUSH // DEFAULT_MAX_BUFFERED_DOCS Disabled by default (because IndexWriter flushes by RAM usage by default). DEFAULT_MAX_BUFFERED_DOCS = DISABLE_AUTO_FLUSH // DEFAULT_RAM_BUFFER_SIZE_MB Default item is 16 MB (which means Flush when buffered docs consume // approximately 16 MB RAM). DEFAULT_RAM_BUFFER_SIZE_MB = 16.0 // DEFAULT_READER_POOLING Default setting (true) for setReaderPooling. // We Changed this default to true with concurrent deletes/updates (LUCENE-7868), // because we will otherwise need to open and close segment readers more frequently. // False is still supported, but will have worse performance since readers will // be forced to aggressively move all state to disk. DEFAULT_READER_POOLING = true // DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB Default item is 1945. Change using setRAMPerThreadHardLimitMB(int) DEFAULT_RAM_PER_THREAD_HARD_LIMIT_MB = 1945 // DEFAULT_USE_COMPOUND_FILE_SYSTEM Default item for compound file system for newly // written segments (set to true). For batch indexing with very large ram buffers use false DEFAULT_USE_COMPOUND_FILE_SYSTEM = true // DEFAULT_COMMIT_ON_CLOSE Default item for whether calls to IndexWriter.close() include a commit. DEFAULT_COMMIT_ON_CLOSE = true // DEFAULT_MAX_FULL_FLUSH_MERGE_WAIT_MILLIS Default item for time to wait for merges // on commit or getReader (when using a MergePolicy that implements MergePolicy.findFullFlushMerges). DEFAULT_MAX_FULL_FLUSH_MERGE_WAIT_MILLIS = 0 )
const BYTES_PER_POSTING = 3 * 4
const HASH_INIT_SIZE = 4
const (
INFO_VERBOSE = false
)
const (
NO_MORE_ORDS = -1
)
const (
ProviderName = "SortField"
)
const ( // TIERED_MERGE_POLICY_DEFAULT_NO_CFS_RATIO // Default noCFSRatio. If a merge's size is >= 10% of the index, then we disable compound file for it. // See Also: MergePolicy.setNoCFSRatio TIERED_MERGE_POLICY_DEFAULT_NO_CFS_RATIO = 0.1 )
const ( // VERBOSE_REF_COUNTS Change to true to see details of reference counts when infoStream is enabled VERBOSE_REF_COUNTS = false )
Variables ¶
var ( FIELD_SCORE = NewSortField("", SCORE) FIELD_DOC = NewSortField("", DOC) )
var (
CODEC_FILE_PATTERN = regexp.MustCompilePOSIX("_[a-z0-9]+(_.*)?\\..*")
)
CODEC_FILE_PATTERN All files created by codecs much match this pattern (checked in SegmentInfo).
var EmptyTermsEnum = &emptyTermsEnum{}
var (
ErrUnsupportedOperation = errors.New("unsupported operation exception")
)
Functions ¶
func FeatureRequested ¶
FeatureRequested Returns true if the given feature is requested in the flags, false otherwise.
func FileNameFromGeneration ¶
func GenerationFromSegmentsFileName ¶
GenerationFromSegmentsFileName Parse the generation off the segments file name and return it.
func GetActualMaxDocs ¶
func GetActualMaxDocs() int
func GetLastCommitGeneration ¶
GetLastCommitGeneration Get the generation of the most recent commit to the list of index files (N in the segments_N file). Params: files – -- array of file names to check
func ImpactComparator ¶
func IndexExists ¶
IndexExists Returns true if an index likely exists at the specified directory. Note that if a corrupt index exists, or if an index in the process of committing Params: directory – the directory to check for an index Returns: true if an index exists; false otherwise
func ParseGeneration ¶
ParseGeneration Returns the generation from this file name, or 0 if there is no generation.
func ParseSegmentName ¶
ParseSegmentName Parses the segment name out of the given file name. Returns: the segment name only, or filename if it does not contain a '.' and '_'.
func Partition ¶
func Partition(config *bkd.Config, maxDoc, splitDim, commonPrefixLen int, reader types.MutablePointValues, from, to, mid int, _scratch1, _scratch2 *bytes.Buffer)
Partition points around mid. All values on the left must be less than or equal to it and all values on the right must be greater than or equal to it.
func RegisterCodec ¶
func RegisterCodec(codec Codec)
func RegisterSortFieldProvider ¶
func RegisterSortFieldProvider(provider SortFieldProvider)
func SegmentFileName ¶
SegmentFileName Returns a file name that includes the given segment name, your own custom name and extension. The format of the filename is: <segmentName>(_<name>)(.<ext>). NOTE: .<ext> is added to the result file name only if ext is not empty. NOTE: _<segmentSuffix> is added to the result file name only if it's not the empty string NOTE: all custom files should be named using this method, or otherwise some structures may fail to handle them properly (such as if they are added to compound files).
func SortByDim ¶
func SortByDim(config *bkd.Config, sortedDim int, commonPrefixLengths []int, reader types.MutablePointValues, from, to int, scratch1, scratch2 *bytes.Buffer)
SortByDim Sort points on the given dimension.
func SortFreqProxTermsWriterPerField ¶
func SortFreqProxTermsWriterPerField(fields []*FreqProxTermsWriterPerField)
func SortTermVectorsConsumerPerField ¶
func SortTermVectorsConsumerPerField(fields []*TermVectorsConsumerPerField)
func StripExtension ¶
StripExtension Removes the extension (anything after the first '.'), otherwise returns the original filename.
func StripSegmentName ¶
StripSegmentName Strips the segment name out of the given file name. If you used segmentFileName or fileNameFromGeneration to create your files, then this method simply removes whatever comes before the first '.', or the second '_' (excluding both). Returns: the filename with the segment name removed, or the given filename if it does not contain a '.' and '_'.
func SubIndex ¶
SubIndex Returns index of the searcher/reader for document n in the array used to construct this searcher/reader.
func TermCompare ¶
func TestLiveDocs ¶
func TestLiveDocs(reader CodecReader) error
func WriteSortField ¶
func WriteSortField(sf SortField, output store.DataOutput) error
Types ¶
type AcceptStatus ¶
type AcceptStatus int
AcceptStatus Return item, if term should be accepted or the iteration should END. The *_SEEK values denote, that after handling the current term the enum should call nextSeekTerm and step forward. See Also: accept(BytesRef)
type AutomatonTermsEnum ¶
type AutomatonTermsEnum struct { *FilteredTermsEnumBase // contains filtered or unexported fields }
AutomatonTermsEnum A FilteredTermsEnum that enumerates terms based upon what is accepted by a DFA. The algorithm is such: As long as matches are successful, keep reading sequentially. When a match fails, skip to the next string in lexicographic order that does not enter a reject state. The algorithm does not attempt to actually skip to the next string that is completely accepted. This is not possible when the language accepted by the FSM is not finite (i.e. * operator). lucene.internal
func (*AutomatonTermsEnum) Accept ¶
func (a *AutomatonTermsEnum) Accept(term []byte) (AcceptStatus, error)
type BaseCodecReader ¶
type BaseCodecReader struct { *BaseLeafReader CodecReaderDefaultSPI }
func NewBaseCodecReader ¶
func NewBaseCodecReader(reader CodecReader) *BaseCodecReader
func (*BaseCodecReader) CheckIntegrity ¶
func (c *BaseCodecReader) CheckIntegrity() error
func (*BaseCodecReader) DocumentV1 ¶
func (c *BaseCodecReader) DocumentV1(docID int, visitor document.StoredFieldVisitor) error
func (*BaseCodecReader) GetBinaryDocValues ¶
func (c *BaseCodecReader) GetBinaryDocValues(field string) (BinaryDocValues, error)
func (*BaseCodecReader) GetNormValues ¶
func (c *BaseCodecReader) GetNormValues(field string) (NumericDocValues, error)
func (*BaseCodecReader) GetNumericDocValues ¶
func (c *BaseCodecReader) GetNumericDocValues(field string) (NumericDocValues, error)
func (*BaseCodecReader) GetPointValues ¶
func (c *BaseCodecReader) GetPointValues(field string) (types.PointValues, bool)
func (*BaseCodecReader) GetSortedDocValues ¶
func (c *BaseCodecReader) GetSortedDocValues(field string) (SortedDocValues, error)
func (*BaseCodecReader) GetSortedNumericDocValues ¶
func (c *BaseCodecReader) GetSortedNumericDocValues(field string) (SortedNumericDocValues, error)
func (*BaseCodecReader) GetSortedSetDocValues ¶
func (c *BaseCodecReader) GetSortedSetDocValues(field string) (SortedSetDocValues, error)
func (*BaseCodecReader) GetTermVectors ¶
func (c *BaseCodecReader) GetTermVectors(docID int) (Fields, error)
type BaseCompositeReader ¶
type BaseCompositeReader struct { *ReaderBase // contains filtered or unexported fields }
func NewBaseCompositeReader ¶
func NewBaseCompositeReader(subReaders []Reader, subReadersSorter func(a, b LeafReader) int) (*BaseCompositeReader, error)
func (*BaseCompositeReader) DoClose ¶
func (b *BaseCompositeReader) DoClose() error
func (*BaseCompositeReader) DocumentV1 ¶
func (b *BaseCompositeReader) DocumentV1(docID int, visitor document.StoredFieldVisitor) error
func (*BaseCompositeReader) GetContext ¶
func (b *BaseCompositeReader) GetContext() (ReaderContext, error)
func (*BaseCompositeReader) GetDocCount ¶
func (b *BaseCompositeReader) GetDocCount(field string) (int, error)
func (*BaseCompositeReader) GetMetaData ¶
func (b *BaseCompositeReader) GetMetaData() *LeafMetaData
func (*BaseCompositeReader) GetReaderCacheHelper ¶
func (b *BaseCompositeReader) GetReaderCacheHelper() CacheHelper
func (*BaseCompositeReader) GetSequentialSubReaders ¶
func (b *BaseCompositeReader) GetSequentialSubReaders() []Reader
func (*BaseCompositeReader) GetSumDocFreq ¶
func (b *BaseCompositeReader) GetSumDocFreq(field string) (int64, error)
func (*BaseCompositeReader) GetSumTotalTermFreq ¶
func (b *BaseCompositeReader) GetSumTotalTermFreq(field string) (int64, error)
func (*BaseCompositeReader) GetTermVectors ¶
func (b *BaseCompositeReader) GetTermVectors(docID int) (Fields, error)
func (*BaseCompositeReader) MaxDoc ¶
func (b *BaseCompositeReader) MaxDoc() int
func (*BaseCompositeReader) NumDocs ¶
func (b *BaseCompositeReader) NumDocs() int
func (*BaseCompositeReader) TotalTermFreq ¶
type BaseLeafReader ¶
type BaseLeafReader struct { LeafReaderBaseInner *ReaderBase // contains filtered or unexported fields }
func NewBaseLeafReader ¶
func NewBaseLeafReader(reader LeafReader) *BaseLeafReader
func (*BaseLeafReader) GetContext ¶
func (r *BaseLeafReader) GetContext() (ReaderContext, error)
func (*BaseLeafReader) GetDocCount ¶
func (r *BaseLeafReader) GetDocCount(field string) (int, error)
func (*BaseLeafReader) GetSumDocFreq ¶
func (r *BaseLeafReader) GetSumDocFreq(field string) (int64, error)
func (*BaseLeafReader) GetSumTotalTermFreq ¶
func (r *BaseLeafReader) GetSumTotalTermFreq(field string) (int64, error)
func (*BaseLeafReader) Postings ¶
func (r *BaseLeafReader) Postings(ctx context.Context, term *Term, flags int) (PostingsEnum, error)
func (*BaseLeafReader) TotalTermFreq ¶
type BasePointsWriter ¶
type BasePointsWriter struct { WriteField func(ctx context.Context, fieldInfo *document.FieldInfo, values PointsReader) error Finish func() error }
func (*BasePointsWriter) Merge ¶
func (p *BasePointsWriter) Merge(mergeState *MergeState) error
Merge Default merge implementation to merge incoming points readers by visiting all their points and adding to this writer
func (*BasePointsWriter) MergeOneField ¶
func (p *BasePointsWriter) MergeOneField(ctx context.Context, mergeState *MergeState, fieldInfo *document.FieldInfo) error
MergeOneField Default naive merge implementation for one field: it just re-indexes all the values from the incoming segment. The default codec overrides this for 1D fields and uses a faster but more complex implementation.
type BaseSortField ¶
type BaseSortField struct {
// contains filtered or unexported fields
}
BaseSortField Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them. Created: Feb 11, 2004 1:25:29 PM Since: lucene 1.4 See Also: Sort
func NewSortField ¶
func NewSortField(field string, _type SortFieldType) *BaseSortField
func NewSortFieldV1 ¶
func NewSortFieldV1(field string, _type SortFieldType, reverse bool) *BaseSortField
func (*BaseSortField) Equals ¶
func (s *BaseSortField) Equals(other SortField) bool
func (*BaseSortField) GetBytesComparator ¶
func (s *BaseSortField) GetBytesComparator() BytesComparator
func (*BaseSortField) GetCanUsePoints ¶
func (s *BaseSortField) GetCanUsePoints() bool
func (*BaseSortField) GetComparator ¶
func (s *BaseSortField) GetComparator(numHits, sortPos int) FieldComparator
func (*BaseSortField) GetComparatorSource ¶
func (s *BaseSortField) GetComparatorSource() FieldComparatorSource
func (*BaseSortField) GetField ¶
func (s *BaseSortField) GetField() string
GetField Returns the name of the field. Could return null if the sort is by SCORE or DOC. Returns: Name of field, possibly null.
func (*BaseSortField) GetIndexSorter ¶
func (s *BaseSortField) GetIndexSorter() IndexSorter
GetIndexSorter Returns an IndexSorter used for sorting index segments by this SortField. If the SortField cannot be used for index sorting (for example, if it uses scores or other query-dependent values) then this method should return null SortFields that implement this method should also implement a companion SortFieldProvider to serialize and deserialize the sort in index segment headers lucene.experimental
func (*BaseSortField) GetMissingValue ¶
func (s *BaseSortField) GetMissingValue() any
GetMissingValue Return the item to use for documents that don't have a item. A item of null indicates that default should be used.
func (*BaseSortField) GetReverse ¶
func (s *BaseSortField) GetReverse() bool
func (*BaseSortField) GetType ¶
func (s *BaseSortField) GetType() SortFieldType
GetType Returns the type of contents in the field. Returns: One of the constants SCORE, DOC, STRING, INT or FLOAT.
func (*BaseSortField) NeedsScores ¶
func (s *BaseSortField) NeedsScores() bool
NeedsScores Whether the relevance score is needed to sort documents.
func (*BaseSortField) Serialize ¶
func (s *BaseSortField) Serialize(ctx context.Context, out store.DataOutput) error
func (*BaseSortField) SetBytesComparator ¶
func (s *BaseSortField) SetBytesComparator(fn BytesComparator)
func (*BaseSortField) SetCanUsePoints ¶
func (s *BaseSortField) SetCanUsePoints()
SetCanUsePoints For numeric sort fields, setting this field, indicates that the same numeric data has been indexed with two fields: doc values and points and that these fields have the same name. This allows to use sort optimization and skip non-competitive documents.
func (*BaseSortField) SetMissingValue ¶
func (s *BaseSortField) SetMissingValue(missingValue any) error
SetMissingValue Set the item to use for documents that don't have a item.
func (*BaseSortField) String ¶
func (s *BaseSortField) String() string
type BaseSortedDocValues ¶
type BaseSortedDocValues struct { BinaryDocValuesDefault FnOrdValue func() (int, error) FnLookupOrd func(ord int) ([]byte, error) FnGetValueCount func() int }
func NewBaseSortedDocValues ¶
func NewBaseSortedDocValues(cfg *SortedDocValuesDefaultConfig) *BaseSortedDocValues
func (*BaseSortedDocValues) BinaryValue ¶
func (r *BaseSortedDocValues) BinaryValue() ([]byte, error)
func (*BaseSortedDocValues) Intersect ¶
func (r *BaseSortedDocValues) Intersect(automaton *automaton.CompiledAutomaton) (TermsEnum, error)
func (*BaseSortedDocValues) LookupTerm ¶
func (r *BaseSortedDocValues) LookupTerm(key []byte) (int, error)
type BaseTermsEnum ¶
type BaseTermsEnum struct {
// contains filtered or unexported fields
}
BaseTermsEnum A base TermsEnum that adds default implementations for * attributes() * termState() * seekExact(BytesRef) * seekExact(BytesRef, TermState) In some cases, the default implementation may be slow and consume huge memory, so subclass SHOULD have its own implementation if possible.
func NewBaseTermsEnum ¶
func NewBaseTermsEnum(cfg *BaseTermsEnumConfig) *BaseTermsEnum
func (*BaseTermsEnum) Attributes ¶
func (b *BaseTermsEnum) Attributes() *attribute.Source
func (*BaseTermsEnum) SeekExactExpert ¶
func (*BaseTermsEnum) TermState ¶
func (b *BaseTermsEnum) TermState() (TermState, error)
type BaseTermsEnumConfig ¶
type BaseTermsEnumConfig struct {
SeekCeil func(ctx context.Context, text []byte) (SeekStatus, error)
}
type BaseTermsHash ¶
type BaseTermsHash struct {
// contains filtered or unexported fields
}
func NewTermsHashDefault ¶
func NewTermsHashDefault(intBlockAllocator ints.IntsAllocator, byteBlockAllocator bytesref.Allocator, nextTermsHash TermsHash) *BaseTermsHash
func (*BaseTermsHash) Abort ¶
func (h *BaseTermsHash) Abort() error
func (*BaseTermsHash) FinishDocument ¶
func (h *BaseTermsHash) FinishDocument(docID int) error
func (*BaseTermsHash) Flush ¶
func (h *BaseTermsHash) Flush(fieldsToFlush map[string]TermsHashPerField, state *SegmentWriteState, sortMap *DocMap, norms NormsProducer) error
func (*BaseTermsHash) GetBytePool ¶
func (h *BaseTermsHash) GetBytePool() *bytesref.BlockPool
func (*BaseTermsHash) GetIntPool ¶
func (h *BaseTermsHash) GetIntPool() *ints.BlockPool
func (*BaseTermsHash) GetTermBytePool ¶
func (h *BaseTermsHash) GetTermBytePool() *bytesref.BlockPool
func (*BaseTermsHash) Reset ¶
func (h *BaseTermsHash) Reset() error
func (*BaseTermsHash) StartDocument ¶
func (h *BaseTermsHash) StartDocument() error
type BinaryDocValues ¶
type BinaryDocValues interface { types.DocValuesIterator // BinaryValue Returns the binary item for the current document ID. It is illegal to call this method after // advanceExact(int) returned false. // Returns: binary item BinaryValue() ([]byte, error) }
BinaryDocValues A per-document numeric item.
func AsBinaryDocValues ¶
func AsBinaryDocValues(iterator DocValuesFieldUpdatesIterator) BinaryDocValues
type BinaryDocValuesDefault ¶
type BinaryDocValuesDefault struct { FnDocID func() int FnNextDoc func() (int, error) FnAdvance func(target int) (int, error) FnSlowAdvance func(target int) (int, error) FnCost func() int64 FnAdvanceExact func(target int) (bool, error) FnBinaryValue func() ([]byte, error) }
func (*BinaryDocValuesDefault) Advance ¶
func (n *BinaryDocValuesDefault) Advance(target int) (int, error)
func (*BinaryDocValuesDefault) AdvanceExact ¶
func (n *BinaryDocValuesDefault) AdvanceExact(target int) (bool, error)
func (*BinaryDocValuesDefault) BinaryValue ¶
func (n *BinaryDocValuesDefault) BinaryValue() ([]byte, error)
func (*BinaryDocValuesDefault) Cost ¶
func (n *BinaryDocValuesDefault) Cost() int64
func (*BinaryDocValuesDefault) DocID ¶
func (n *BinaryDocValuesDefault) DocID() int
func (*BinaryDocValuesDefault) NextDoc ¶
func (n *BinaryDocValuesDefault) NextDoc() (int, error)
func (*BinaryDocValuesDefault) SlowAdvance ¶
func (n *BinaryDocValuesDefault) SlowAdvance(target int) (int, error)
type BinaryDocValuesFieldUpdates ¶
type BinaryDocValuesFieldUpdates struct { *DocValuesFieldUpdatesDefault // contains filtered or unexported fields }
BinaryDocValuesFieldUpdates A DocValuesFieldUpdates which holds updates of documents, of a single BinaryDocValuesField. lucene.experimental
func (*BinaryDocValuesFieldUpdates) AddBytes ¶
func (b *BinaryDocValuesFieldUpdates) AddBytes(doc int, value []byte) error
func (*BinaryDocValuesFieldUpdates) AddInt64 ¶
func (b *BinaryDocValuesFieldUpdates) AddInt64(doc int, value int64) error
func (*BinaryDocValuesFieldUpdates) AddIterator ¶
func (b *BinaryDocValuesFieldUpdates) AddIterator(doc int, it DocValuesFieldUpdatesIterator) error
func (*BinaryDocValuesFieldUpdates) EnsureFinished ¶
func (b *BinaryDocValuesFieldUpdates) EnsureFinished() error
func (*BinaryDocValuesFieldUpdates) Finish ¶
func (b *BinaryDocValuesFieldUpdates) Finish() error
func (*BinaryDocValuesFieldUpdates) Grow ¶
func (b *BinaryDocValuesFieldUpdates) Grow(size int) error
func (*BinaryDocValuesFieldUpdates) Iterator ¶
func (b *BinaryDocValuesFieldUpdates) Iterator() (DocValuesFieldUpdatesIterator, error)
func (*BinaryDocValuesFieldUpdates) Reset ¶
func (b *BinaryDocValuesFieldUpdates) Reset(doc int) error
func (*BinaryDocValuesFieldUpdates) Resize ¶
func (b *BinaryDocValuesFieldUpdates) Resize(size int) error
func (*BinaryDocValuesFieldUpdates) Swap ¶
func (b *BinaryDocValuesFieldUpdates) Swap(i, j int) error
type BinaryDocValuesUpdate ¶
type BinaryDocValuesUpdate struct { }
func NewBinaryDocValuesUpdate ¶
func NewBinaryDocValuesUpdate(term *Term, field string, value []byte) *BinaryDocValuesUpdate
func (*BinaryDocValuesUpdate) GetDocValuesType ¶
func (b *BinaryDocValuesUpdate) GetDocValuesType() document.DocValuesType
func (*BinaryDocValuesUpdate) GetOptions ¶
func (b *BinaryDocValuesUpdate) GetOptions() *DocValuesUpdateOptions
func (*BinaryDocValuesUpdate) HasValue ¶
func (b *BinaryDocValuesUpdate) HasValue() bool
func (*BinaryDocValuesUpdate) ValueSizeInBytes ¶
func (b *BinaryDocValuesUpdate) ValueSizeInBytes() int64
func (*BinaryDocValuesUpdate) ValueToString ¶
func (b *BinaryDocValuesUpdate) ValueToString() string
func (*BinaryDocValuesUpdate) WriteTo ¶
func (b *BinaryDocValuesUpdate) WriteTo(output store.DataOutput) error
type BinaryDocValuesWriter ¶
type BinaryDocValuesWriter struct {
// contains filtered or unexported fields
}
func NewBinaryDocValuesWriter ¶
func NewBinaryDocValuesWriter(fieldInfo *document.FieldInfo) *BinaryDocValuesWriter
func (*BinaryDocValuesWriter) AddValue ¶
func (b *BinaryDocValuesWriter) AddValue(docID int, value []byte) error
func (*BinaryDocValuesWriter) Flush ¶
func (b *BinaryDocValuesWriter) Flush(state *SegmentWriteState, sortMap DocMap, consumer DocValuesConsumer) error
func (*BinaryDocValuesWriter) GetDocValues ¶
func (b *BinaryDocValuesWriter) GetDocValues() types.DocIdSetIterator
type BitSetIterator ¶
type BitSetIterator struct {
// contains filtered or unexported fields
}
func NewBitSetIterator ¶
func NewBitSetIterator(bits *bitset.BitSet, cost int64) *BitSetIterator
func (*BitSetIterator) Cost ¶
func (b *BitSetIterator) Cost() int64
func (*BitSetIterator) DocID ¶
func (b *BitSetIterator) DocID() int
func (*BitSetIterator) GetBitSet ¶
func (b *BitSetIterator) GetBitSet() *bitset.BitSet
func (*BitSetIterator) NextDoc ¶
func (b *BitSetIterator) NextDoc() (int, error)
func (*BitSetIterator) SlowAdvance ¶
func (b *BitSetIterator) SlowAdvance(target int) (int, error)
type BufferedBinaryDocValues ¶
type BufferedBinaryDocValues struct {
// contains filtered or unexported fields
}
func NewBufferedBinaryDocValues ¶
func NewBufferedBinaryDocValues(values [][]byte, docsWithField types.DocIdSetIterator) *BufferedBinaryDocValues
func (*BufferedBinaryDocValues) Advance ¶
func (b *BufferedBinaryDocValues) Advance(target int) (int, error)
func (*BufferedBinaryDocValues) AdvanceExact ¶
func (b *BufferedBinaryDocValues) AdvanceExact(target int) (bool, error)
func (*BufferedBinaryDocValues) BinaryValue ¶
func (b *BufferedBinaryDocValues) BinaryValue() ([]byte, error)
func (*BufferedBinaryDocValues) Cost ¶
func (b *BufferedBinaryDocValues) Cost() int64
func (*BufferedBinaryDocValues) DocID ¶
func (b *BufferedBinaryDocValues) DocID() int
func (*BufferedBinaryDocValues) NextDoc ¶
func (b *BufferedBinaryDocValues) NextDoc() (int, error)
func (*BufferedBinaryDocValues) SlowAdvance ¶
func (b *BufferedBinaryDocValues) SlowAdvance(target int) (int, error)
type BufferedNumericDocValues ¶
type BufferedNumericDocValues struct {
// contains filtered or unexported fields
}
func NewBufferedNumericDocValues ¶
func NewBufferedNumericDocValues(values *packed.PackedLongValues, docsWithFields types.DocIdSetIterator) *BufferedNumericDocValues
func (*BufferedNumericDocValues) Advance ¶
func (b *BufferedNumericDocValues) Advance(target int) (int, error)
func (*BufferedNumericDocValues) AdvanceExact ¶
func (b *BufferedNumericDocValues) AdvanceExact(target int) (bool, error)
func (*BufferedNumericDocValues) Cost ¶
func (b *BufferedNumericDocValues) Cost() int64
func (*BufferedNumericDocValues) DocID ¶
func (b *BufferedNumericDocValues) DocID() int
func (*BufferedNumericDocValues) LongValue ¶
func (b *BufferedNumericDocValues) LongValue() (int64, error)
func (*BufferedNumericDocValues) NextDoc ¶
func (b *BufferedNumericDocValues) NextDoc() (int, error)
func (*BufferedNumericDocValues) SlowAdvance ¶
func (b *BufferedNumericDocValues) SlowAdvance(target int) (int, error)
type BufferedUpdates ¶
type BufferedUpdates struct {
// contains filtered or unexported fields
}
BufferedUpdates Holds buffered deletes and updates, by docID, term or query for a single segment. This is used to hold buffered pending deletes and updates against the to-be-flushed segment. Once the deletes and updates are pushed (on Flush in DocumentsWriter), they are converted to a FrozenBufferedUpdates instance and pushed to the BufferedUpdatesStream.
NOTE: instances of this class are accessed either via a private instance on DocumentWriterPerThread, or via sync'd code by DocumentsWriterDeleteQueue
func NewBufferedUpdates ¶
func NewBufferedUpdates(options ...BufferedUpdatesOption) *BufferedUpdates
func (*BufferedUpdates) AddBinaryUpdate ¶
func (b *BufferedUpdates) AddBinaryUpdate(update *BinaryDocValuesUpdate, docIDUpto int) error
func (*BufferedUpdates) AddNumericUpdate ¶
func (b *BufferedUpdates) AddNumericUpdate(update *NumericDocValuesUpdate, docIDUpto int) error
func (*BufferedUpdates) AddTerm ¶
func (b *BufferedUpdates) AddTerm(term *Term, docIDUpto int)
type BufferedUpdatesOption ¶
type BufferedUpdatesOption func(*bufferedUpdatesOption)
func WithSegmentName ¶
func WithSegmentName(segmentName string) BufferedUpdatesOption
type BufferedUpdatesStream ¶
type BufferedUpdatesStream struct {
// contains filtered or unexported fields
}
BufferedUpdatesStream Tracks the stream of FrozenBufferedUpdates. When DocumentsWriterPerThread flushes, its buffered deletes and updates are appended to this stream and immediately resolved (to actual docIDs, per segment) using the indexing thread that triggered the flush for concurrency. When a merge kicks off, we sync to ensure all resolving packets complete. We also apply to all segments when NRT reader is pulled, commit/close is called, or when too many deletes or updates are buffered and must be flushed (by RAM usage or by count). Each packet is assigned a generation, and each flushed or merged segment is also assigned a generation, so we can track which BufferedDeletes packets to apply to any given segment.
func NewBufferedUpdatesStream ¶
func NewBufferedUpdatesStream() *BufferedUpdatesStream
func (*BufferedUpdatesStream) GetCompletedDelGen ¶
func (b *BufferedUpdatesStream) GetCompletedDelGen() int64
type ByteSliceReader ¶
type ByteSliceReader struct { *store.BaseDataInput // contains filtered or unexported fields }
ByteSliceReader IndexInput that knows how to read the byte slices written by Posting and PostingVector. We read the bytes in each slice until we hit the end of that slice at which point we read the forwarding address of the next slice and then jump to it.
func NewByteSliceReader ¶
func NewByteSliceReader() *ByteSliceReader
func (*ByteSliceReader) Clone ¶
func (b *ByteSliceReader) Clone() store.CloneReader
type BytesComparator ¶
type CacheHelper ¶
type CacheHelper interface { // GetKey // Get a key that the resource can be cached on. The given entry can be compared using identity, // ie. Object.equals is implemented as == and Object.hashCode is implemented as System.identityHashCode. GetKey() }
CacheHelper A utility class that gives hooks in order to help build a cache based on the data that is contained in this index. lucene.experimental
type ClosedListener ¶
type ClosedListener interface { }
type Codec ¶
type Codec interface { NamedSPI // PostingsFormat Encodes/decodes postings PostingsFormat() PostingsFormat // DocValuesFormat Encodes/decodes docvalues DocValuesFormat() DocValuesFormat // StoredFieldsFormat Encodes/decodes stored fields StoredFieldsFormat() StoredFieldsFormat // TermVectorsFormat Encodes/decodes term vectors TermVectorsFormat() TermVectorsFormat // FieldInfosFormat Encodes/decodes field infos file FieldInfosFormat() FieldInfosFormat // SegmentInfoFormat Encodes/decodes segment info file SegmentInfoFormat() SegmentInfoFormat // NormsFormat Encodes/decodes document normalization values NormsFormat() NormsFormat // LiveDocsFormat Encodes/decodes live docs LiveDocsFormat() LiveDocsFormat // CompoundFormat Encodes/decodes compound files CompoundFormat() CompoundFormat // PointsFormat Encodes/decodes points index PointsFormat() PointsFormat }
Codec Encodes/decodes an inverted index segment. Note, when extending this class, the name (getName) is written into the index. In order for the segment to be read, the name must resolve to your implementation via forName(String). This method uses Java's Service SortFieldProvider Interface (SPI) to resolve codec names. If you implement your own codec, make sure that it has a no-arg constructor so SPI can load it. See Also: ServiceLoader
type CodecReader ¶
type CodecReader interface { LeafReader // GetFieldsReader Expert: retrieve thread-private StoredFieldsReader // lucene.internal GetFieldsReader() StoredFieldsReader // GetTermVectorsReader Expert: retrieve thread-private TermVectorsReader // lucene.internal GetTermVectorsReader() TermVectorsReader // GetNormsReader Expert: retrieve underlying NormsProducer // lucene.internal GetNormsReader() NormsProducer // GetDocValuesReader Expert: retrieve underlying DocValuesProducer // lucene.internal GetDocValuesReader() DocValuesProducer // GetPostingsReader Expert: retrieve underlying FieldsProducer // lucene.internal GetPostingsReader() FieldsProducer // GetPointsReader Expert: retrieve underlying PointsReader // lucene.internal GetPointsReader() PointsReader }
type CodecReaderDefaultSPI ¶
type CodecReaderDefaultSPI interface { GetFieldsReader() StoredFieldsReader GetTermVectorsReader() TermVectorsReader GetPostingsReader() FieldsProducer GetFieldInfos() *FieldInfos MaxDoc() int GetDocValuesReader() DocValuesProducer GetNormsReader() NormsProducer GetPointsReader() PointsReader }
type CommitPoint ¶
type CommitPoint struct {
// contains filtered or unexported fields
}
CommitPoint Holds details for each commit point. This class is also passed to the deletion policy. Note: this class has a natural ordering that is inconsistent with equals.
func NewCommitPoint ¶
func NewCommitPoint(commitsToDelete *[]*CommitPoint, directoryOrig store.Directory, segmentInfos *SegmentInfos) (*CommitPoint, error)
func (*CommitPoint) CompareTo ¶
func (c *CommitPoint) CompareTo(commit IndexCommit) int
func (*CommitPoint) Delete ¶
func (c *CommitPoint) Delete() error
Delete Called only be the deletion policy, to remove this commit point from the index.
func (*CommitPoint) GetDirectory ¶
func (c *CommitPoint) GetDirectory() store.Directory
func (*CommitPoint) GetFileNames ¶
func (c *CommitPoint) GetFileNames() (map[string]struct{}, error)
func (*CommitPoint) GetGeneration ¶
func (c *CommitPoint) GetGeneration() int64
func (*CommitPoint) GetReader ¶
func (c *CommitPoint) GetReader() *StandardDirectoryReader
func (*CommitPoint) GetSegmentCount ¶
func (c *CommitPoint) GetSegmentCount() int
func (*CommitPoint) GetSegmentsFileName ¶
func (c *CommitPoint) GetSegmentsFileName() string
func (*CommitPoint) GetUserData ¶
func (c *CommitPoint) GetUserData() (map[string]string, error)
func (*CommitPoint) IsDeleted ¶
func (c *CommitPoint) IsDeleted() bool
type ComparableProvider ¶
type ComparableProvider interface { // GetAsComparableLong Returns a long so that the natural ordering of long values // matches the ordering of doc IDs for the given comparator GetAsComparableLong(docID int) (int64, error) }
ComparableProvider Used for sorting documents across segments 用于跨多个段(segment)进行文档排序
type CompetitiveImpactAccumulator ¶
type CompetitiveImpactAccumulator struct {
// contains filtered or unexported fields
}
CompetitiveImpactAccumulator This class accumulates the (freq, norm) pairs that may produce competitive scores.
func NewCompetitiveImpactAccumulator ¶
func NewCompetitiveImpactAccumulator() *CompetitiveImpactAccumulator
func (*CompetitiveImpactAccumulator) Add ¶
func (c *CompetitiveImpactAccumulator) Add(freq int, norm int64)
Add Accumulate a (freq,norm) pair, updating this structure if there is no equivalent or more competitive entry already.
func (*CompetitiveImpactAccumulator) AddAll ¶
func (c *CompetitiveImpactAccumulator) AddAll(acc *CompetitiveImpactAccumulator)
AddAll Merge acc into this.
func (*CompetitiveImpactAccumulator) Clear ¶
func (c *CompetitiveImpactAccumulator) Clear()
func (*CompetitiveImpactAccumulator) GetCompetitiveFreqNormPairs ¶
func (c *CompetitiveImpactAccumulator) GetCompetitiveFreqNormPairs() []*Impact
GetCompetitiveFreqNormPairs Get the set of competitive freq and norm pairs, ordered by increasing freq and norm.
type CompositeReader ¶
type CompositeReader interface { Reader // GetSequentialSubReaders // Expert: returns the sequential sub readers that this reader is logically composed of. // This method may not return null. // NOTE: In contrast to previous Lucene versions this method is no longer public, code that // wants to get all LeafReaders this composite is composed of should use Reader.leaves(). // See Also: Reader.leaves() GetSequentialSubReaders() []Reader }
CompositeReader Instances of this reader type can only be used to get stored fields from the underlying LeafReaders, but it is not possible to directly retrieve postings. To do that, get the LeafReaderContext for all sub-readers via leaves().
Reader instances for indexes on disk are usually constructed with a call to one of the static DirectoryReader.open() methods, e.g. DirectoryReader.open(Directory). DirectoryReader implements the CompositeReader interface, it is not possible to directly get postings. Concrete subclasses of Reader are usually constructed with a call to one of the static open() methods, e.g. DirectoryReader.open(Directory).
For efficiency, in this API documents are often referred to via document numbers, non-negative integers which each name a unique document in the index. These document numbers are ephemeral -- they may change as documents are added to and deleted from an index. Clients should thus not rely on a given document having the same number between sessions.
NOTE: Reader instances are completely thread safe, meaning multiple threads can call any of its methods, concurrently. If your application requires external synchronization, you should not synchronize on the Reader instance; use your own (non-Lucene) objects instead.
type CompositeReaderBuilder ¶
type CompositeReaderBuilder struct {
// contains filtered or unexported fields
}
func NewCompositeReaderBuilder ¶
func NewCompositeReaderBuilder(reader CompositeReader) *CompositeReaderBuilder
func (*CompositeReaderBuilder) Build ¶
func (c *CompositeReaderBuilder) Build() (*CompositeReaderContext, error)
type CompositeReaderContext ¶
type CompositeReaderContext struct { *IndexReaderContextDefault // contains filtered or unexported fields }
CompositeReaderContext ReaderContext for CompositeReader instance.
func NewCompositeReaderContext ¶
func NewCompositeReaderContext(fn CompositeReaderContextOption) (*CompositeReaderContext, error)
func (*CompositeReaderContext) Children ¶
func (c *CompositeReaderContext) Children() []ReaderContext
func (*CompositeReaderContext) Leaves ¶
func (c *CompositeReaderContext) Leaves() ([]*LeafReaderContext, error)
func (*CompositeReaderContext) Reader ¶
func (c *CompositeReaderContext) Reader() Reader
type CompositeReaderContextOption ¶
type CompositeReaderContextOption func(*compositeReaderContextOption)
func WithCompositeReaderContextV1 ¶
func WithCompositeReaderContextV1(reader CompositeReader) CompositeReaderContextOption
func WithCompositeReaderContextV2 ¶
func WithCompositeReaderContextV2(parent *CompositeReaderContext, reader CompositeReader, ordInParent, docbaseInParent int, children *arraylist.List[ReaderContext]) CompositeReaderContextOption
func WithCompositeReaderContextV3 ¶
func WithCompositeReaderContextV3(reader CompositeReader, children, leaves *arraylist.List[ReaderContext]) CompositeReaderContextOption
type CompoundDirectory ¶
type CompoundDirectory interface { store.Directory // CheckIntegrity Checks consistency of this directory. // Note that this may be costly in terms of I/O, e.g. may involve computing a checksum // item against large data files. CheckIntegrity() error }
CompoundDirectory A read-only Directory that consists of a view over a compound file. See Also: CompoundFormat lucene.experimental
type CompoundDirectoryDefault ¶
type CompoundDirectoryDefault struct { }
func (*CompoundDirectoryDefault) CreateOutput ¶
func (*CompoundDirectoryDefault) CreateOutput(ctx context.Context, name string) (store.IndexOutput, error)
func (*CompoundDirectoryDefault) CreateTempOutput ¶
func (*CompoundDirectoryDefault) CreateTempOutput(ctx context.Context, prefix, suffix string) (store.IndexOutput, error)
func (*CompoundDirectoryDefault) DeleteFile ¶
func (*CompoundDirectoryDefault) DeleteFile(ctx context.Context, name string) error
func (*CompoundDirectoryDefault) ObtainLock ¶
func (*CompoundDirectoryDefault) ObtainLock(name string) (store.Lock, error)
func (*CompoundDirectoryDefault) Rename ¶
func (*CompoundDirectoryDefault) Rename(ctx context.Context, source, dest string) error
func (*CompoundDirectoryDefault) Sync ¶
func (*CompoundDirectoryDefault) Sync(ctx context.Context, names []string) error
func (*CompoundDirectoryDefault) SyncMetaData ¶
func (*CompoundDirectoryDefault) SyncMetaData(ctx context.Context) error
type CompoundFormat ¶
type CompoundFormat interface { // GetCompoundReader Returns a Directory view (read-only) for the compound files in this segment GetCompoundReader(dir store.Directory, si *SegmentInfo, context *store.IOContext) (CompoundDirectory, error) // Write Packs the provided segment's files into a compound format. All files referenced // by the provided SegmentInfo must have CodecUtil.writeIndexHeader and CodecUtil.writeFooter. Write(dir store.Directory, si *SegmentInfo, context *store.IOContext) error }
CompoundFormat Encodes/decodes compound files lucene.experimental
type ConcurrentMergeScheduler ¶
type ConcurrentMergeScheduler struct { }
ConcurrentMergeScheduler A MergeScheduler that runs each merge using a separate thread. Specify the max number of threads that may run at once, and the maximum number of simultaneous merges with setMaxMergesAndThreads.
If the number of merges exceeds the max number of threads then the largest merges are paused until one of the smaller merges completes.
If more than getMaxMergeCount merges are requested then this class will forcefully throttle the incoming threads by pausing until one more merges complete.
This class attempts to detect whether the index is on rotational storage (traditional hard drive) or not (e.g. solid-state disk) and changes the default max merge and thread count accordingly. This detection is currently Linux-only, and relies on the OS to put the right item into /sys/block/<dev>/block/rotational. For all other operating systems it currently assumes a rotational disk for backwards compatibility. To enable default settings for spinning or solid state disks for such operating systems, use setDefaultMaxMergesAndThreads(boolean).
func NewConcurrentMergeScheduler ¶
func NewConcurrentMergeScheduler() *ConcurrentMergeScheduler
func (*ConcurrentMergeScheduler) Close ¶
func (c *ConcurrentMergeScheduler) Close() error
func (*ConcurrentMergeScheduler) Initialize ¶
func (c *ConcurrentMergeScheduler) Initialize(dir store.Directory)
func (*ConcurrentMergeScheduler) Merge ¶
func (c *ConcurrentMergeScheduler) Merge(mergeSource MergeSource, trigger MergeTrigger) error
type DVFUIterator ¶
type DVFUIterator struct { }
func (*DVFUIterator) AdvanceExact ¶
func (*DVFUIterator) AdvanceExact(target int) (bool, error)
func (*DVFUIterator) Cost ¶
func (*DVFUIterator) Cost() int64
type DataFields ¶
type DataFields struct {
// contains filtered or unexported fields
}
func NewDataFields ¶
func NewDataFields(fields []*FieldData) *DataFields
func (*DataFields) Names ¶
func (d *DataFields) Names() []string
func (*DataFields) Size ¶
func (d *DataFields) Size() int
type DataPostingsEnum ¶
type DataPostingsEnum struct {
// contains filtered or unexported fields
}
func (*DataPostingsEnum) Cost ¶
func (d *DataPostingsEnum) Cost() int64
func (*DataPostingsEnum) DocID ¶
func (d *DataPostingsEnum) DocID() int
func (*DataPostingsEnum) EndOffset ¶
func (d *DataPostingsEnum) EndOffset() (int, error)
func (*DataPostingsEnum) Freq ¶
func (d *DataPostingsEnum) Freq() (int, error)
func (*DataPostingsEnum) GetPayload ¶
func (d *DataPostingsEnum) GetPayload() ([]byte, error)
func (*DataPostingsEnum) NextDoc ¶
func (d *DataPostingsEnum) NextDoc() (int, error)
func (*DataPostingsEnum) NextPosition ¶
func (d *DataPostingsEnum) NextPosition() (int, error)
func (*DataPostingsEnum) SlowAdvance ¶
func (d *DataPostingsEnum) SlowAdvance(target int) (int, error)
func (*DataPostingsEnum) StartOffset ¶
func (d *DataPostingsEnum) StartOffset() (int, error)
type DataTerms ¶
type DataTerms struct { *TermsBase // contains filtered or unexported fields }
func NewDataTerms ¶
func (*DataTerms) GetDocCount ¶
func (*DataTerms) GetSumDocFreq ¶
func (*DataTerms) GetSumTotalTermFreq ¶
func (*DataTerms) HasOffsets ¶
func (*DataTerms) HasPayloads ¶
func (*DataTerms) HasPositions ¶
type DataTermsEnum ¶
type DataTermsEnum struct { *BaseTermsEnum // contains filtered or unexported fields }
func NewDataTermsEnum ¶
func NewDataTermsEnum(fieldData *FieldData) *DataTermsEnum
func (*DataTermsEnum) DocFreq ¶
func (d *DataTermsEnum) DocFreq() (int, error)
func (*DataTermsEnum) Impacts ¶
func (d *DataTermsEnum) Impacts(flags int) (ImpactsEnum, error)
func (*DataTermsEnum) Ord ¶
func (d *DataTermsEnum) Ord() (int64, error)
func (*DataTermsEnum) Postings ¶
func (d *DataTermsEnum) Postings(reuse PostingsEnum, flags int) (PostingsEnum, error)
func (*DataTermsEnum) SeekCeil ¶
func (d *DataTermsEnum) SeekCeil(ctx context.Context, text []byte) (SeekStatus, error)
func (*DataTermsEnum) SeekExactByOrd ¶
func (d *DataTermsEnum) SeekExactByOrd(ctx context.Context, ord int64) error
func (*DataTermsEnum) Term ¶
func (d *DataTermsEnum) Term() ([]byte, error)
func (*DataTermsEnum) TotalTermFreq ¶
func (d *DataTermsEnum) TotalTermFreq() (int64, error)
type DefaultIndexingChain ¶
type DefaultIndexingChain struct {
// contains filtered or unexported fields
}
DefaultIndexingChain Default general purpose indexing chain, which handles indexing all types of fields.
func NewDefaultIndexingChain ¶
func NewDefaultIndexingChain(indexCreatedVersionMajor int, segmentInfo *SegmentInfo, dir store.Directory, fieldInfos *FieldInfosBuilder, indexWriterConfig *liveIndexWriterConfig) *DefaultIndexingChain
func (*DefaultIndexingChain) Abort ¶
func (d *DefaultIndexingChain) Abort() error
func (*DefaultIndexingChain) Flush ¶
func (d *DefaultIndexingChain) Flush(ctx context.Context, state *SegmentWriteState) (*DocMap, error)
func (*DefaultIndexingChain) GetHasDocValues ¶
func (d *DefaultIndexingChain) GetHasDocValues(field string) types.DocIdSetIterator
func (*DefaultIndexingChain) NewPerField ¶
func (d *DefaultIndexingChain) NewPerField(indexCreatedVersionMajor int, fieldInfo *document.FieldInfo, invert bool, similarity Similarity, analyzer analysis.Analyzer) (*PerField, error)
func (*DefaultIndexingChain) ProcessDocument ¶
type DeleteSlice ¶
type DeleteSlice struct {
// contains filtered or unexported fields
}
func NewDeleteSlice ¶
func NewDeleteSlice(currentTail *Node) *DeleteSlice
func (*DeleteSlice) Apply ¶
func (d *DeleteSlice) Apply(del *BufferedUpdates, docIDUpto int)
func (*DeleteSlice) Reset ¶
func (d *DeleteSlice) Reset()
type DirectoryReader ¶
type DirectoryReader interface { CompositeReader Directory() store.Directory // GetVersion // Version number when this Reader was opened. // This method returns the version recorded in the commit that the reader opened. // This version is advanced every time a change is made with IndexWriter. GetVersion() int64 // IsCurrent // Check whether any new changes have occurred to the index since this reader was opened. // If this reader was created by calling open, then this method checks if any further commits // (see IndexWriter.commit) have occurred in the directory. // If instead this reader is a near real-time reader (ie, obtained by a call to open(IndexWriter), // or by calling openIfChanged on a near real-time reader), then this method checks if either a // new commit has occurred, or any new uncommitted changes have taken place via the writer. // Note that even if the writer has only performed merging, this method will still return false. // In any event, if this returns false, you should call openIfChanged to get a new reader that sees the changes. // Throws: IOException – if there is a low-level IO error IsCurrent(ctx context.Context) (bool, error) // GetIndexCommit // Expert: return the IndexCommit that this reader has opened. // lucene.experimental GetIndexCommit() (IndexCommit, error) }
DirectoryReader is an implementation of CompositeReader that can read indexes in a Directory. DirectoryReader instances are usually constructed with a call to one of the static open() methods, e.g. open(Directory). For efficiency, in this API documents are often referred to via document numbers, non-negative integers which each name a unique document in the index. These document numbers are ephemeral -- they may change as documents are added to and deleted from an index. Clients should thus not rely on a given document having the same number between sessions.
NOTE: Reader instances are completely thread safe, meaning multiple threads can call any of its methods, concurrently. If your application requires external synchronization, you should not synchronize on the Reader instance; use your own (non-Lucene) objects instead.
func DirectoryReaderOpen ¶
func DirectoryReaderOpen(writer *Writer) (DirectoryReader, error)
func DirectoryReaderOpenV1 ¶
func DirectoryReaderOpenV1(writer *Writer, applyAllDeletes, writeAllDeletes bool) (DirectoryReader, error)
func OpenDirectoryReader ¶
func OpenDirectoryReader(directory store.Directory, commit IndexCommit, leafSorter func(a, b Reader) int) (DirectoryReader, error)
OpenDirectoryReader called from DirectoryReader.open(...) methods
type DirectoryReaderDefault ¶
type DirectoryReaderDefault struct { *BaseCompositeReader // contains filtered or unexported fields }
func NewDirectoryReader ¶
func NewDirectoryReader(directory store.Directory, segmentReaders []Reader, leafSorter func(a, b LeafReader) int) (*DirectoryReaderDefault, error)
func (*DirectoryReaderDefault) Directory ¶
func (d *DirectoryReaderDefault) Directory() store.Directory
type DocComparator ¶
type DocComparator interface { // Compare docID1 against docID2. The contract for the return item is // the same as cmp.Compare(Object, Object). Compare(docID1, docID2 int) int }
DocComparator A comparator of doc IDs, used for sorting documents within a segment 用于段内文档的排序
type DocConsumer ¶
type DocConsumer interface { ProcessDocument(ctx context.Context, docId int, document *document.Document) error Flush(ctx context.Context, state *SegmentWriteState) (*DocMap, error) Abort() error // GetHasDocValues Returns a DocIdSetIterator for the given field or null // if the field doesn't have doc values. GetHasDocValues(field string) types.DocIdSetIterator }
type DocIdSet ¶
type DocIdSet interface { // Iterator // DVFUIterator Provides a DocIdSetIterator to access the set. // This implementation can return null if there are no docs that match. Iterator() (types.DocIdSetIterator, error) // Bits // TODO: somehow this class should express the cost of // iteration vs the cost of random access Bits; for // expensive Filters (e.g. distance < 1 km) we should use // bits() after all other Query/Filters have matched, but // this is the opposite of what bits() is for now // (down-low filtering using e.g. FixedBitSet) // Optionally provides a Bits interface for random access to matching documents. // Returns: null, if this DocIdSet does not support random access. In contrast to iterator(), // a return item of null does not imply that no documents match the filter! // The default implementation does not provide random access, // so you only need to implement this method if your DocIdSet can guarantee random // access to every docid in O(1) time without external disk access // (as Bits interface cannot throw IOException). This is generally true for bit sets // like org.apache.lucene.util.FixedBitSet, which return itself if they are used as DocIdSet. Bits() (util.Bits, error) }
A DocIdSet contains a set of doc ids. Implementing classes must only implement iterator to provide access to the set.
type DocMap ¶
type DocMap struct { // Given a doc ID from the original index, return its ordinal in the sorted index. OldToNew func(docID int) int // Given the ordinal of a doc ID, return its doc ID in the original index. NewToOld func(docID int) int // Return the number of documents in this map. // This must be equal to the number of documents of the LeafReader which is sorted. Size func() int }
DocMap A permutation of doc IDs. For every document ID between 0 and Reader.maxDoc(), oldToNew(newToOld(docID)) must return docID.
func SortByComparator ¶
func SortByComparator(maxDoc int, comparator DocComparator) *DocMap
func SortByComparators ¶
func SortByComparators(maxDoc int, comparators []DocComparator) (*DocMap, error)
type DocValueSorter ¶
type DocValueSorter struct {
// contains filtered or unexported fields
}
func NewDocValueSorter ¶
func NewDocValueSorter(docs []int, comparator DocComparator) *DocValueSorter
func (*DocValueSorter) Len ¶
func (d *DocValueSorter) Len() int
func (*DocValueSorter) Less ¶
func (d *DocValueSorter) Less(i, j int) bool
func (*DocValueSorter) Swap ¶
func (d *DocValueSorter) Swap(i, j int)
type DocValuesConsumer ¶
type DocValuesConsumer interface { io.Closer // AddNumericField Writes numeric docvalues for a field. // @param field field information // @param valuesProducer Numeric values to write. // @throws IOException if an I/O error occurred. AddNumericField(ctx context.Context, field *document.FieldInfo, valuesProducer DocValuesProducer) error // AddBinaryField Writes binary docvalues for a field. // @param field field information // @param valuesProducer Binary values to write. // @throws IOException if an I/O error occurred. AddBinaryField(ctx context.Context, field *document.FieldInfo, valuesProducer DocValuesProducer) error // AddSortedField Writes pre-sorted binary docvalues for a field. // @param field field information // @param valuesProducer produces the values and ordinals to write // @throws IOException if an I/O error occurred. AddSortedField(ctx context.Context, field *document.FieldInfo, valuesProducer DocValuesProducer) error // AddSortedNumericField Writes pre-sorted numeric docvalues for a field // @param field field information // @param valuesProducer produces the values to write // @throws IOException if an I/O error occurred. AddSortedNumericField(ctx context.Context, field *document.FieldInfo, valuesProducer DocValuesProducer) error // AddSortedSetField Writes pre-sorted set docvalues for a field // @param field field information // @param valuesProducer produces the values to write // @throws IOException if an I/O error occurred. AddSortedSetField(ctx context.Context, field *document.FieldInfo, valuesProducer DocValuesProducer) error }
DocValuesConsumer Abstract API that consumes numeric, binary and sorted docvalues. Concrete implementations of this actually do "something" with the docvalues (write it into the index in a specific format). The lifecycle is:
- DocValuesConsumer is created by NormsFormat.normsConsumer(SegmentWriteState).
- addNumericField, addBinaryField, addSortedField, addSortedSetField, or addSortedNumericField are called for each Numeric, Binary, Sorted, SortedSet, or SortedNumeric docvalues field. The API is a "pull" rather than "push", and the implementation is free to iterate over the values multiple times (Iterable.iterator()).
- After all fields are added, the consumer is closed.
lucene.experimental
type DocValuesFieldUpdates ¶
type DocValuesFieldUpdates interface { Field() string AddInt64(doc int, value int64) error AddBytes(doc int, value []byte) error // AddIterator // Adds the item for the given docID. This method prevents conditional calls to // DocValuesFieldUpdates.Iterator.longValue() or DocValuesFieldUpdates.Iterator.binaryValue() // since the implementation knows if it's a long item iterator or binary item AddIterator(doc int, it DocValuesFieldUpdatesIterator) error // Iterator // Returns an DocValuesFieldUpdates.Iterator over the updated documents and their values. Iterator() (DocValuesFieldUpdatesIterator, error) // Finish // Freezes internal data structures and sorts updates by docID for efficient iteration. Finish() error // Any // Returns true if this instance contains any updates. Any() bool Size() int // Reset // Adds an update that resets the documents item. // Params: doc – the doc to update Reset(doc int) error Swap(i, j int) error Grow(i int) error Resize(i int) error EnsureFinished() error GetFinished() bool }
DocValuesFieldUpdates holds updates of a single docvalues field, for a set of documents within one segment.
type DocValuesFieldUpdatesDefault ¶
type DocValuesFieldUpdatesDefault struct {
// contains filtered or unexported fields
}
func (*DocValuesFieldUpdatesDefault) Any ¶
func (d *DocValuesFieldUpdatesDefault) Any() bool
Any Returns true if this instance contains any updates.
func (*DocValuesFieldUpdatesDefault) Field ¶
func (d *DocValuesFieldUpdatesDefault) Field() string
func (*DocValuesFieldUpdatesDefault) Finish ¶
func (d *DocValuesFieldUpdatesDefault) Finish() error
func (*DocValuesFieldUpdatesDefault) GetFinished ¶
func (d *DocValuesFieldUpdatesDefault) GetFinished() bool
func (*DocValuesFieldUpdatesDefault) Grow ¶
func (d *DocValuesFieldUpdatesDefault) Grow(size int) error
func (*DocValuesFieldUpdatesDefault) Resize ¶
func (d *DocValuesFieldUpdatesDefault) Resize(size int) error
func (*DocValuesFieldUpdatesDefault) Size ¶
func (d *DocValuesFieldUpdatesDefault) Size() int
func (*DocValuesFieldUpdatesDefault) Swap ¶
func (d *DocValuesFieldUpdatesDefault) Swap(i, j int) error
type DocValuesFieldUpdatesIterator ¶
type DocValuesFieldUpdatesIterator interface { types.DocValuesIterator // LongValue Returns a long item for the current document if this iterator is a long iterator. LongValue() (int64, error) // BinaryValue Returns a binary item for the current document if this iterator is a binary item iterator. BinaryValue() ([]byte, error) // DelGen Returns delGen for this packet. DelGen() int64 // HasValue Returns true if this doc has a item HasValue() bool }
DocValuesFieldUpdatesIterator An iterator over documents and their updated values. Only documents with updates are returned by this iterator, and the documents are returned in increasing order.
type DocValuesFormat ¶
type DocValuesFormat interface { NamedSPI // FieldsConsumer Returns a DocValuesConsumer to write docvalues to the index. FieldsConsumer(state *SegmentWriteState) (DocValuesConsumer, error) // FieldsProducer Returns a DocValuesProducer to read docvalues from the index. // NOTE: by the time this call returns, it must hold open any files it will need to use; else, // those files may be deleted. Additionally, required files may be deleted during the execution // of this call before there is a chance to open them. Under these circumstances an IOException // should be thrown by the implementation. IOExceptions are expected and will automatically // cause a retry of the segment opening logic with the newly revised segments. FieldsProducer(state *SegmentReadState) (DocValuesProducer, error) }
type DocValuesLeafReader ¶
type DocValuesLeafReader struct {
*BaseLeafReader
}
func NewDocValuesLeafReader ¶
func NewDocValuesLeafReader() *DocValuesLeafReader
func (*DocValuesLeafReader) CheckIntegrity ¶
func (d *DocValuesLeafReader) CheckIntegrity() error
func (*DocValuesLeafReader) DoClose ¶
func (d *DocValuesLeafReader) DoClose() error
func (*DocValuesLeafReader) DocumentV1 ¶
func (d *DocValuesLeafReader) DocumentV1(docID int, visitor document.StoredFieldVisitor) error
func (*DocValuesLeafReader) GetBinaryDocValues ¶
func (d *DocValuesLeafReader) GetBinaryDocValues(field string) (BinaryDocValues, error)
func (*DocValuesLeafReader) GetFieldInfos ¶
func (d *DocValuesLeafReader) GetFieldInfos() *FieldInfos
func (*DocValuesLeafReader) GetLiveDocs ¶
func (d *DocValuesLeafReader) GetLiveDocs() util.Bits
func (*DocValuesLeafReader) GetMetaData ¶
func (d *DocValuesLeafReader) GetMetaData() *LeafMetaData
func (*DocValuesLeafReader) GetNormValues ¶
func (d *DocValuesLeafReader) GetNormValues(field string) (NumericDocValues, error)
func (*DocValuesLeafReader) GetNumericDocValues ¶
func (d *DocValuesLeafReader) GetNumericDocValues(field string) (NumericDocValues, error)
func (*DocValuesLeafReader) GetPointValues ¶
func (d *DocValuesLeafReader) GetPointValues(field string) (types.PointValues, bool)
func (*DocValuesLeafReader) GetReaderCacheHelper ¶
func (d *DocValuesLeafReader) GetReaderCacheHelper() CacheHelper
func (*DocValuesLeafReader) GetSortedDocValues ¶
func (d *DocValuesLeafReader) GetSortedDocValues(field string) (SortedDocValues, error)
func (*DocValuesLeafReader) GetSortedNumericDocValues ¶
func (d *DocValuesLeafReader) GetSortedNumericDocValues(field string) (SortedNumericDocValues, error)
func (*DocValuesLeafReader) GetSortedSetDocValues ¶
func (d *DocValuesLeafReader) GetSortedSetDocValues(field string) (SortedSetDocValues, error)
func (*DocValuesLeafReader) GetTermVectors ¶
func (d *DocValuesLeafReader) GetTermVectors(docID int) (Fields, error)
func (*DocValuesLeafReader) MaxDoc ¶
func (d *DocValuesLeafReader) MaxDoc() int
func (*DocValuesLeafReader) NumDocs ¶
func (d *DocValuesLeafReader) NumDocs() int
type DocValuesProducer ¶
type DocValuesProducer interface { io.Closer // GetNumeric Returns NumericDocValues for this field. The returned instance need not be thread-safe: // it will only be used by a single thread. GetNumeric(field *document.FieldInfo) (NumericDocValues, error) // GetBinary Returns BinaryDocValues for this field. The returned instance need not be thread-safe: // it will only be used by a single thread. GetBinary(field *document.FieldInfo) (BinaryDocValues, error) // GetSorted Returns SortedDocValues for this field. The returned instance need not be // thread-safe: it will only be used by a single thread. GetSorted(field *document.FieldInfo) (SortedDocValues, error) // GetSortedNumeric Returns SortedNumericDocValues for this field. The returned instance // need not be thread-safe: it will only be used by a single thread. GetSortedNumeric(field *document.FieldInfo) (SortedNumericDocValues, error) // GetSortedSet Returns SortedSetDocValues for this field. The returned instance need not // be thread-safe: it will only be used by a single thread. GetSortedSet(field *document.FieldInfo) (SortedSetDocValues, error) // CheckIntegrity Checks consistency of this producer // Note that this may be costly in terms of I/O, e.g. may involve computing a checksum item // against large data files. // lucene.internal CheckIntegrity() error // GetMergeInstance // Returns an instance optimized for merging. This instance may only be consumed in the thread // that called GetMergeInstance(). // The default implementation returns this GetMergeInstance() DocValuesProducer }
DocValuesProducer Abstract API that produces numeric, binary, sorted, sortedset, and sortednumeric docvalues. lucene.experimental
type DocValuesUpdate ¶
type DocValuesUpdate interface { ValueSizeInBytes() int64 ValueToString() string WriteTo(output store.DataOutput) error HasValue() bool GetOptions() *DocValuesUpdateOptions }
DocValuesUpdate An in-place update to a DocValues field.
type DocValuesUpdateOptions ¶
type DocValuesUpdatesNode ¶
type DocValuesUpdatesNode struct {
// contains filtered or unexported fields
}
func NewDocValuesUpdatesNode ¶
func NewDocValuesUpdatesNode(updates []DocValuesUpdate) *DocValuesUpdatesNode
func (*DocValuesUpdatesNode) Apply ¶
func (d *DocValuesUpdatesNode) Apply(bufferedDeletes *BufferedUpdates, docIDUpto int) error
func (*DocValuesUpdatesNode) IsDelete ¶
func (d *DocValuesUpdatesNode) IsDelete() bool
type DocValuesWriter ¶
type DocValuesWriter interface { Flush(state *SegmentWriteState, sortMap DocMap, consumer DocValuesConsumer) error GetDocValues() types.DocIdSetIterator }
type DocsWithFieldSet ¶
type DocsWithFieldSet struct {
// contains filtered or unexported fields
}
func NewDocsWithFieldSet ¶
func NewDocsWithFieldSet() *DocsWithFieldSet
func (*DocsWithFieldSet) Add ¶
func (d *DocsWithFieldSet) Add(docID int) error
func (*DocsWithFieldSet) Iterator ¶
func (d *DocsWithFieldSet) Iterator() (types.DocIdSetIterator, error)
type DocumentsWriter ¶
type DocumentsWriter struct {
// contains filtered or unexported fields
}
DocumentsWriter This class accepts multiple added documents and directly writes segment files. Each added document is passed to the indexing chain, which in turn processes the document into the different codec formats. Some formats write bytes to files immediately, e.g. stored fields and term vectors, while others are buffered by the indexing chain and written only on Flush. Once we have used our allowed RAM buffer, or the number of added docs is large enough (in the case we are flushing by doc count instead of RAM usage), we create a real segment and Flush it to the Directory. Threads: Multiple threads are allowed into addDocument at once. There is an initial synchronized call to DocumentsWriterFlushControl.ObtainAndLock() which allocates a DWPT for this indexing thread. The same thread will not necessarily get the same DWPT over time. Then updateDocuments is called on that DWPT without synchronization (most of the "heavy lifting" is in this call). Once a DWPT fills up enough RAM or hold enough documents in memory the DWPT is checked out for Flush and all changes are written to the directory. Each DWPT corresponds to one segment being written. When Flush is called by IndexWriter we check out all DWPTs that are associated with the current DocumentsWriterDeleteQueue out of the DocumentsWriterPerThreadPool and write them to disk. The Flush process can piggy-back on incoming indexing threads or even block them from adding documents if flushing can't keep up with new documents being added. Unless the stall control kicks in to block indexing threads flushes are happening concurrently to actual index requests. Exceptions: Because this class directly updates in-memory posting lists, and flushes stored fields and term vectors directly to files in the directory, there are certain limited times when an exception can corrupt this state. For example, a disk full while flushing stored fields leaves this file in a corrupt state. Or, an OOM exception while appending to the in-memory posting lists can corrupt that posting list. We call such exceptions "aborting exceptions". In these cases we must call abort() to discard all docs added since the last Flush. All other exceptions ("non-aborting exceptions") can still partially update the index structures. These updates are consistent, but, they represent only a part of the document seen up until the exception was hit. When this happens, we immediately mark the document as deleted so that the document is always atomically ("all or none") added to the index.
func NewDocumentsWriter ¶
func NewDocumentsWriter(indexCreatedVersionMajor int, pendingNumDocs *atomic.Int64, enableTestPoints bool, segmentName string, config *liveIndexWriterConfig, directoryOrig, directory store.Directory, globalFieldNumberMap *FieldNumbers) *DocumentsWriter
func (*DocumentsWriter) FinishFullFlush ¶
func (d *DocumentsWriter) FinishFullFlush(success bool) error
type DocumentsWriterDeleteQueue ¶
type DocumentsWriterDeleteQueue struct {
// contains filtered or unexported fields
}
DocumentsWriterDeleteQueue is a non-blocking linked pending deletes queue. In contrast to other queue implementation we only maintain the tail of the queue. A delete queue is always used in a context of a set of DWPTs and a global delete pool. Each of the DWPT and the global pool need to maintain their 'own' head of the queue (as a DeleteSlice instance per DocumentsWriterPerThread).
The difference between the DWPT and the global pool is that the DWPT starts maintaining a head once it has added its first document since for its segments private deletes only the deletes after that document are relevant. The global pool instead starts maintaining the head once this instance is created by taking the sentinel instance as its initial head.
Since each DocumentsWriterDeleteQueue.DeleteSlice maintains its own head and the list is only single linked the garbage collector takes care of pruning the list for us. All nodes in the list that are still relevant should be either directly or indirectly referenced by one of the DWPT's private DocumentsWriterDeleteQueue.DeleteSlice or by the global BufferedUpdates slice. Each DWPT as well as the global delete pool maintain their private DeleteSlice instance. In the DWPT case updating a slice is equivalent to atomically finishing the document. The slice update guarantees a "happens before" relationship to all other updates in the same indexing session. When a DWPT updates a document it:
1. consumes a document and finishes its processing 2. updates its private DocumentsWriterDeleteQueue.DeleteSlice either by calling updateSlice(DocumentsWriterDeleteQueue.DeleteSlice) or add(DocumentsWriterDeleteQueue.Node, DocumentsWriterDeleteQueue.DeleteSlice) (if the document has a delTerm) 3. applies all deletes in the slice to its private BufferedUpdates and resets it 4. increments its internal document id
The DWPT also doesn't apply its current documents delete term until it has updated its delete slice which ensures the consistency of the update. If the update fails before the DeleteSlice could have been updated the deleteTerm will also not be added to its private deletes neither to the global deletes.
func NewDocumentsWriterDeleteQueue ¶
func NewDocumentsWriterDeleteQueue() *DocumentsWriterDeleteQueue
func (*DocumentsWriterDeleteQueue) Add ¶
func (d *DocumentsWriterDeleteQueue) Add(deleteNode *Node, slice *DeleteSlice) int64
func (*DocumentsWriterDeleteQueue) UpdateSlice ¶
func (d *DocumentsWriterDeleteQueue) UpdateSlice(slice *DeleteSlice) int64
UpdateSlice Negative result means there were new deletes since we last applied
type DocumentsWriterFlushControl ¶
type DocumentsWriterFlushControl struct {
// contains filtered or unexported fields
}
DocumentsWriterFlushControl This class controls DocumentsWriterPerThread flushing during indexing. It tracks the memory consumption per DocumentsWriterPerThread and uses a configured FlushPolicy to decide if a DocumentsWriterPerThread must Flush.
In addition to the FlushPolicy the Flush control might set certain DocumentsWriterPerThread as Flush pending iff a DocumentsWriterPerThread exceeds the IndexWriterConfig.getRAMPerThreadHardLimitMB() to prevent address space exhaustion.
func (*DocumentsWriterFlushControl) ObtainAndLock ¶
func (d *DocumentsWriterFlushControl) ObtainAndLock() *DocumentsWriterPerThread
type DocumentsWriterFlushQueue ¶
type DocumentsWriterFlushQueue struct {
// contains filtered or unexported fields
}
DocumentsWriterFlushQueue lucene.internal
type DocumentsWriterPerThread ¶
type DocumentsWriterPerThread struct {
// contains filtered or unexported fields
}
func NewDocumentsWriterPerThread ¶
func NewDocumentsWriterPerThread(indexVersionCreated int, segmentName string, dirOrig, dir store.Directory, indexWriterConfig *liveIndexWriterConfig, deleteQueue *DocumentsWriterDeleteQueue, fieldInfos *FieldInfosBuilder, pendingNumDocs *atomic.Int64, enableTestPoints bool) *DocumentsWriterPerThread
func (*DocumentsWriterPerThread) Flush ¶
func (d *DocumentsWriterPerThread) Flush(ctx context.Context) error
func (*DocumentsWriterPerThread) GetNumDocsInRAM ¶
func (d *DocumentsWriterPerThread) GetNumDocsInRAM() int
type DocumentsWriterPerThreadPool ¶
type DocumentsWriterPerThreadPool struct { }
DocumentsWriterPerThreadPool controls DocumentsWriterPerThread instances and their thread assignments during indexing. Each DocumentsWriterPerThread is once a obtained from the pool exclusively used for indexing a single document or list of documents by the obtaining thread. Each indexing thread must obtain such a DocumentsWriterPerThread to make progress. Depending on the DocumentsWriterPerThreadPool implementation DocumentsWriterPerThread assignments might differ from document to document. Once a DocumentsWriterPerThread is selected for Flush the DocumentsWriterPerThread will be checked out of the thread pool and won't be reused for indexing. See checkout(DocumentsWriterPerThread).
type DoubleComparableProvider ¶
type DoubleComparableProvider struct {
// contains filtered or unexported fields
}
func (*DoubleComparableProvider) GetAsComparableLong ¶
func (d *DoubleComparableProvider) GetAsComparableLong(docID int) (int64, error)
type DoubleDocComparator ¶
type DoubleDocComparator struct {
// contains filtered or unexported fields
}
func (*DoubleDocComparator) Compare ¶
func (d *DoubleDocComparator) Compare(docID1, docID2 int) int
type DoubleSorter ¶
type DoubleSorter struct {
// contains filtered or unexported fields
}
DoubleSorter Sorts documents based on double values from a NumericDocValues instance
func NewDoubleSorter ¶
func NewDoubleSorter(providerName string, missingValue float64, reverse bool, valuesProvider NumericDocValuesProvider) *DoubleSorter
func (*DoubleSorter) GetComparableProviders ¶
func (d *DoubleSorter) GetComparableProviders(readers []LeafReader) ([]ComparableProvider, error)
func (*DoubleSorter) GetDocComparator ¶
func (d *DoubleSorter) GetDocComparator(reader LeafReader, maxDoc int) (DocComparator, error)
func (*DoubleSorter) GetProviderName ¶
func (d *DoubleSorter) GetProviderName() string
type EmptyDocComparator ¶
func (*EmptyDocComparator) Compare ¶
func (e *EmptyDocComparator) Compare(docID1, docID2 int) int
type EmptyDocValuesProducer ¶
type EmptyDocValuesProducer struct { FnGetNumeric func(field *document.FieldInfo) (NumericDocValues, error) FnGetBinary func(field *document.FieldInfo) (BinaryDocValues, error) FnGetSorted func(field *document.FieldInfo) (SortedDocValues, error) FnGetSortedNumeric func(field *document.FieldInfo) (SortedNumericDocValues, error) FnGetSortedSet func(field *document.FieldInfo) (SortedSetDocValues, error) FnCheckIntegrity func() error }
func (*EmptyDocValuesProducer) CheckIntegrity ¶
func (e *EmptyDocValuesProducer) CheckIntegrity() error
func (*EmptyDocValuesProducer) Close ¶
func (e *EmptyDocValuesProducer) Close() error
func (*EmptyDocValuesProducer) GetBinary ¶
func (e *EmptyDocValuesProducer) GetBinary(field *document.FieldInfo) (BinaryDocValues, error)
func (*EmptyDocValuesProducer) GetMergeInstance ¶
func (e *EmptyDocValuesProducer) GetMergeInstance() DocValuesProducer
func (*EmptyDocValuesProducer) GetNumeric ¶
func (e *EmptyDocValuesProducer) GetNumeric(field *document.FieldInfo) (NumericDocValues, error)
func (*EmptyDocValuesProducer) GetSorted ¶
func (e *EmptyDocValuesProducer) GetSorted(field *document.FieldInfo) (SortedDocValues, error)
func (*EmptyDocValuesProducer) GetSortedNumeric ¶
func (e *EmptyDocValuesProducer) GetSortedNumeric(field *document.FieldInfo) (SortedNumericDocValues, error)
func (*EmptyDocValuesProducer) GetSortedSet ¶
func (e *EmptyDocValuesProducer) GetSortedSet(field *document.FieldInfo) (SortedSetDocValues, error)
type EmptyNumericDocValuesProvider ¶
type EmptyNumericDocValuesProvider struct {
FnGet func(reader LeafReader) (NumericDocValues, error)
}
func (*EmptyNumericDocValuesProvider) Get ¶
func (e *EmptyNumericDocValuesProvider) Get(reader LeafReader) (NumericDocValues, error)
type EmptySortedDocValuesProvider ¶
type EmptySortedDocValuesProvider struct {
FnGet func(reader LeafReader) (SortedDocValues, error)
}
func (*EmptySortedDocValuesProvider) Get ¶
func (e *EmptySortedDocValuesProvider) Get(reader LeafReader) (SortedDocValues, error)
type EventQueue ¶
type EventQueue struct {
// contains filtered or unexported fields
}
func NewEventQueue ¶
func NewEventQueue(writer *Writer) *EventQueue
func (*EventQueue) Add ¶
func (e *EventQueue) Add(event Event) bool
type FieldComparator ¶
type FieldComparator interface { // Compare hit at slot1 with hit at slot2. // Params: slot1 – first slot to compare // slot2 – second slot to compare // Returns: any N < 0 if slot2's item is sorted after slot1, any N > 0 if the slot2's item is sorted // before slot1 and 0 if they are equal Compare(slot1, slot2 int) int // SetTopValue Record the top item, for future calls to LeafFieldComparator.compareTop. This is only // called for searches that use searchAfter (deep paging), and is called before any calls to // getLeafComparator(LeafReaderContext). SetTopValue(value any) // Value Return the actual item in the slot. // Params: slot – the item // Returns: item in this slot Value(slot int) any // GetLeafComparator Get a per-segment LeafFieldComparator to collect the given LeafReaderContext. // All docIDs supplied to this LeafFieldComparator are relative to the current reader (you must // add docBase if you need to map it to a top-level docID). // Params: context – current reader context // Returns: the comparator to use for this segment // Throws: IOException – if there is a low-level IO error GetLeafComparator(context *LeafReaderContext) (LeafFieldComparator, error) // CompareValues // Returns a negative integer if first is less than second, // 0 if they are equal and a positive integer otherwise. // Default impl to assume the type implements Comparable and invoke .compareTo; // be sure to override this method if your FieldComparator's type isn't a // Comparable or if your values may sometimes be null CompareValues(first, second any) int // SetSingleSort Informs the comparator that sort is done on this single field. // This is useful to enable some optimizations for skipping non-competitive documents. SetSingleSort() // DisableSkipping Informs the comparator that the skipping of documents should be disabled. // This function is called in cases when the skipping functionality should not be applied // or not necessary. One example for numeric comparators is when we don't know if the same // numeric data has been indexed with docValues and points if these two fields have the // same name. As the skipping functionality relies on these fields to have the same data // and as we don't know if it is true, we have to disable it. Another example could be // when search sort is a part of the index sort, and can be already efficiently handled by // TopFieldCollector, and doing extra work for skipping in the comparator is redundant. DisableSkipping() }
FieldComparator Expert: a FieldComparator compares hits so as to determine their sort order when collecting the top results with TopFieldCollector. The concrete public FieldComparator classes here correspond to the SortField types. The document IDs passed to these methods must only move forwards, since they are using doc values iterators to retrieve sort values. This API is designed to achieve high performance sorting, by exposing a tight interaction with FieldValueHitQueue as it visits hits. Whenever a hit is competitive, it's enrolled into a virtual slot, which is an int ranging from 0 to numHits-1. Segment transitions are handled by creating a dedicated per-segment LeafFieldComparator which also needs to interact with the FieldValueHitQueue but can optimize based on the segment to collect. The following functions need to be implemented compare Compare a hit at 'slot a' with hit 'slot b'. setTopValue This method is called by TopFieldCollector to notify the FieldComparator of the top most item, which is used by future calls to LeafFieldComparator.compareTop. getLeafComparator(LeafReaderContext) Invoked when the search is switching to the next segment. You may need to update internal state of the comparator, for example retrieving new values from DocValues. item Return the sort item stored in the specified slot. This is only called at the end of the search, in order to populate FieldDoc.fields when returning the top results. See Also: LeafFieldComparator lucene.experimental
type FieldComparatorSource ¶
type FieldComparatorSource interface {
NewComparator(fieldName string, numHits, sortPos int, reversed bool) FieldComparator
}
FieldComparatorSource Provides a FieldComparator for custom field sorting. lucene.experimental
type FieldData ¶
type FieldData struct {
// contains filtered or unexported fields
}
func NewFieldData ¶
type FieldDataList ¶
type FieldDataList []FieldData
func (FieldDataList) Len ¶
func (f FieldDataList) Len() int
func (FieldDataList) Less ¶
func (f FieldDataList) Less(i, j int) bool
func (FieldDataList) Swap ¶
func (f FieldDataList) Swap(i, j int)
type FieldDimensions ¶
func NewFieldDimensions ¶
func NewFieldDimensions(dimensionCount, indexDimensionCount, dimensionNumBytes int) *FieldDimensions
type FieldInfos ¶
type FieldInfos struct {
// contains filtered or unexported fields
}
FieldInfos Collection of FieldInfos (accessible by number or by name).
func NewFieldInfos ¶
func NewFieldInfos(infos []*document.FieldInfo) *FieldInfos
func (*FieldInfos) FieldInfoByNumber ¶
func (f *FieldInfos) FieldInfoByNumber(fieldNumber int) *document.FieldInfo
func (*FieldInfos) HasDocValues ¶
func (f *FieldInfos) HasDocValues() bool
func (*FieldInfos) HasNorms ¶
func (f *FieldInfos) HasNorms() bool
func (*FieldInfos) HasPointValues ¶
func (f *FieldInfos) HasPointValues() bool
func (*FieldInfos) HasVectors ¶
func (f *FieldInfos) HasVectors() bool
func (*FieldInfos) List ¶
func (f *FieldInfos) List() []*document.FieldInfo
func (*FieldInfos) Size ¶
func (f *FieldInfos) Size() int
type FieldInfosBuilder ¶
type FieldInfosBuilder struct {
// contains filtered or unexported fields
}
func NewFieldInfosBuilder ¶
func NewFieldInfosBuilder(globalFieldNumbers *FieldNumbers) *FieldInfosBuilder
func (*FieldInfosBuilder) Add ¶
func (f *FieldInfosBuilder) Add(other *FieldInfos) error
func (*FieldInfosBuilder) AddFieldInfo ¶
func (*FieldInfosBuilder) AddFieldInfoV ¶
func (*FieldInfosBuilder) Finish ¶
func (f *FieldInfosBuilder) Finish() *FieldInfos
type FieldInfosFormat ¶
type FieldInfosFormat interface { // Read the FieldInfos previously written with write. Read(directory store.Directory, segmentInfo *SegmentInfo, segmentSuffix string, ctx *store.IOContext) (*FieldInfos, error) // Write Writes the provided FieldInfos to the directory. Write(directory store.Directory, segmentInfo *SegmentInfo, segmentSuffix string, infos *FieldInfos, context *store.IOContext) error }
type FieldInvertState ¶
type FieldInvertState struct {
// contains filtered or unexported fields
}
FieldInvertState This class tracks the number and position / offset parameters of terms being added to the index. The information collected in this class is also used to calculate the normalization factor for a field.
func NewFieldInvertState ¶
func NewFieldInvertState(indexCreatedVersionMajor int, name string, indexOptions document.IndexOptions, position int, length int, numOverlap int, offset int, maxTermFrequency int, uniqueTermCount int) *FieldInvertState
NewFieldInvertState Creates {code FieldInvertState} for the specified field name and values for all fields.
func NewFieldInvertStateV1 ¶
func NewFieldInvertStateV1(indexCreatedVersionMajor int, name string, indexOptions document.IndexOptions) *FieldInvertState
func (*FieldInvertState) GetAttributeSource ¶
func (f *FieldInvertState) GetAttributeSource() *attribute.Source
GetAttributeSource Returns the AttributeSourceV2 from the TokenStream that provided the indexed tokens for this field.
func (*FieldInvertState) GetIndexCreatedVersionMajor ¶
func (f *FieldInvertState) GetIndexCreatedVersionMajor() int
GetIndexCreatedVersionMajor Return the version that was used to create the index, or 6 if it was created before 7.0.
func (*FieldInvertState) GetIndexOptions ¶
func (f *FieldInvertState) GetIndexOptions() document.IndexOptions
GetIndexOptions Get the index options for this field
func (*FieldInvertState) GetLength ¶
func (f *FieldInvertState) GetLength() int
GetLength Get total number of terms in this field. Returns: the length
func (*FieldInvertState) GetMaxTermFrequency ¶
func (f *FieldInvertState) GetMaxTermFrequency() int
GetMaxTermFrequency Get the maximum term-frequency encountered for any term in the field. A field containing "the quick brown fox jumps over the lazy dog" would have a item of 2, because "the" appears twice.
func (*FieldInvertState) GetName ¶
func (f *FieldInvertState) GetName() string
GetName Return the field's name
func (*FieldInvertState) GetNumOverlap ¶
func (f *FieldInvertState) GetNumOverlap() int
GetNumOverlap Get the number of terms with positionIncrement == 0. Returns: the numOverlap
func (*FieldInvertState) GetOffset ¶
func (f *FieldInvertState) GetOffset() int
GetOffset Get end offset of the last processed term. Returns: the offset
func (*FieldInvertState) GetPosition ¶
func (f *FieldInvertState) GetPosition() int
GetPosition Get the last processed term position. Returns: the position
func (*FieldInvertState) GetUniqueTermCount ¶
func (f *FieldInvertState) GetUniqueTermCount() int
GetUniqueTermCount Return the number of unique terms encountered in this field.
func (*FieldInvertState) Reset ¶
func (f *FieldInvertState) Reset()
func (*FieldInvertState) SetAttributeSource ¶
func (f *FieldInvertState) SetAttributeSource(attributeSource *attribute.Source)
func (*FieldInvertState) SetLength ¶
func (f *FieldInvertState) SetLength(length int)
SetLength Set length item.
func (*FieldInvertState) SetNumOverlap ¶
func (f *FieldInvertState) SetNumOverlap(numOverlap int)
SetNumOverlap Set number of terms with positionIncrement == 0.
type FieldNumbers ¶
func NewFieldNumbers ¶
func NewFieldNumbers(softDeletesFieldName string) *FieldNumbers
func (*FieldNumbers) AddOrGet ¶
func (f *FieldNumbers) AddOrGet(fieldName string, preferredFieldNumber int, indexOptions document.IndexOptions, dvType document.DocValuesType, dimensionCount, indexDimensionCount, dimensionNumBytes int, isSoftDeletesField bool) (int, error)
AddOrGet Returns the global field number for the given field name. If the name does not exist yet it tries to add it with the given preferred field number assigned if possible otherwise the first unassigned field number is used as the field number.
func (*FieldNumbers) SetDimensions ¶
func (f *FieldNumbers) SetDimensions(number int, name string, dimensionCount, indexDimensionCount, dimensionNumBytes int)
type FieldTermIterator ¶
type FieldTermIterator interface { bytesref.BytesIterator // Field // Returns current field. // This method should not be called after iteration is done. // Note that you may use == to detect a change in field. Field() string // DelGen Del gen of the current term. DelGen() int64 }
FieldTermIterator Iterates over terms in across multiple fields. The caller must check field after each next to see if the field changed, but == can be used since the iterator implementation ensures it will use the same String instance for a given field.
type FieldUpdatesBuffer ¶
type FieldUpdatesBuffer struct {
// contains filtered or unexported fields
}
FieldUpdatesBuffer This class efficiently buffers numeric and binary field updates and stores terms, values and metadata in a memory efficient way without creating large amounts of objects. Update terms are stored without de-duplicating the update term. In general we try to optimize for several use-cases. For instance we try to use constant space for update terms field since the common case always updates on the same field. Also for docUpTo we try to optimize for the case when updates should be applied to all docs ie. docUpTo=Integer.MAX_VALUE. In other cases each update will likely have a different docUpTo. Along the same lines this impl optimizes the case when all updates have a item. Lastly, if all updates share the same item for a numeric field we only store the item once.
func NewDefaultFieldUpdatesBuffer ¶
func NewDefaultFieldUpdatesBuffer() *FieldUpdatesBuffer
type Fields ¶
type Fields interface { Names() []string // Terms Get the Terms for this field. This will return null if the field does not exist. Terms(field string) (Terms, error) // Size Returns the number of fields or -1 if the number of distinct field names is unknown. If >= 0, // iterator will return as many field names. Size() int }
Fields Provides a Terms index for fields that have it, and lists which fields do. This is primarily an internal/experimental API (see FieldsProducer), although it is also used to expose the set of term vectors per document.
type FieldsConsumer ¶
type FieldsConsumer interface { io.Closer // Write all fields, terms and postings. This the "pull" API, allowing you to iterate more than once // over the postings, somewhat analogous to using a DOM API to traverse an XML tree. // Notes: // * You must compute index statistics, including each Term's docFreq and totalTermFreq, as well as the // summary sumTotalTermFreq, sumTotalDocFreq and docCount. // * You must skip terms that have no docs and fields that have no terms, even though the provided Fields // API will expose them; this typically requires lazily writing the field or term until you've actually // seen the first term or document. // * The provided Fields instance is limited: you cannot call any methods that return statistics/counts; // you cannot pass a non-null live docs when pulling docs/positions enums. Write(fields Fields, norms NormsProducer) error // Merge Merges in the fields from the readers in mergeState. The default implementation skips and // maps around deleted documents, and calls write(Fields, NormsProducer). Implementations can override // this method for more sophisticated merging (bulk-byte copying, etc). Merge(mergeState *MergeState, norms NormsProducer) error }
type FieldsConsumerDefault ¶
type FieldsConsumerDefault struct { // Merges in the fields from the readers in mergeState. // The default implementation skips and maps around deleted documents, // and calls write(Fields, NormsProducer). Implementations can override // this method for more sophisticated merging (bulk-byte copying, etc). Write func(fields Fields, norms NormsProducer) error // NOTE: strange but necessary so javadocs linting is happy: Closer func() error }
func (*FieldsConsumerDefault) Merge ¶
func (f *FieldsConsumerDefault) Merge(mergeState *MergeState, norms NormsProducer) error
Merge Merges in the fields from the readers in mergeState. The default implementation skips and maps around deleted documents, and calls write(Fields, NormsProducer). Implementations can override this method for more sophisticated merging (bulk-byte copying, etc).
type FieldsConsumerExt ¶
type FieldsConsumerExt interface { // Merge Merges in the fields from the readers in mergeState. The default implementation skips and // maps around deleted documents, and calls write(Fields, NormsProducer). Implementations can override // this method for more sophisticated merging (bulk-byte copying, etc). Merge(mergeState *MergeState, norms NormsProducer) error }
type FieldsProducer ¶
type FieldsProducer interface { io.Closer Fields // CheckIntegrity Checks consistency of this reader. // Note that this may be costly in terms of I/O, e.g. may involve computing a checksum item against large // data files. CheckIntegrity() error // GetMergeInstance Returns an instance optimized for merging. This instance may only be consumed in the // thread that called getMergeInstance(). // The default implementation returns this GetMergeInstance() FieldsProducer }
FieldsProducer Sole constructor. (For invocation by subclass constructors, typically implicit.)
type FilterLeafReader ¶
type FilterLeafReader struct { }
A FilterLeafReader contains another LeafReader, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The class FilterLeafReader itself simply implements all abstract methods of Reader with versions that pass all requests to the contained index reader. Subclasses of FilterLeafReader may further override some of these methods and may also provide additional methods and fields. NOTE: If you override getLiveDocs(), you will likely need to override numDocs() as well and vice-versa. NOTE: If this FilterLeafReader does not change the content the contained reader, you could consider delegating calls to getCoreCacheHelper() and getReaderCacheHelper().
type FilteredTermsEnum ¶
type FilteredTermsEnum interface { TermsEnum // Accept Return if term is accepted, not accepted or the iteration should ended (and possibly seek). Accept(term []byte) (AcceptStatus, error) }
type FilteredTermsEnumBase ¶
type FilteredTermsEnumBase struct { Accept func(term []byte) (AcceptStatus, error) NextSeekTerm func(currentTerm []byte) ([]byte, error) // contains filtered or unexported fields }
func NewFilteredTermsEnumDefault ¶
func NewFilteredTermsEnumDefault(cfg *FilteredTermsEnumDefaultConfig) *FilteredTermsEnumBase
func (*FilteredTermsEnumBase) Attributes ¶
func (f *FilteredTermsEnumBase) Attributes() *attribute.Source
Attributes Returns the related attributes, the returned AttributeSource is shared with the delegate TermsEnum.
func (*FilteredTermsEnumBase) DocFreq ¶
func (f *FilteredTermsEnumBase) DocFreq() (int, error)
func (*FilteredTermsEnumBase) Impacts ¶
func (f *FilteredTermsEnumBase) Impacts(flags int) (ImpactsEnum, error)
func (*FilteredTermsEnumBase) Next ¶
func (f *FilteredTermsEnumBase) Next(context.Context) ([]byte, error)
func (*FilteredTermsEnumBase) Ord ¶
func (f *FilteredTermsEnumBase) Ord() (int64, error)
func (*FilteredTermsEnumBase) Postings ¶
func (f *FilteredTermsEnumBase) Postings(reuse PostingsEnum, flags int) (PostingsEnum, error)
func (*FilteredTermsEnumBase) SeekCeil ¶
func (f *FilteredTermsEnumBase) SeekCeil(ctx context.Context, text []byte) (SeekStatus, error)
func (*FilteredTermsEnumBase) SeekExactByOrd ¶
func (f *FilteredTermsEnumBase) SeekExactByOrd(ctx context.Context, ord int64) error
func (*FilteredTermsEnumBase) SeekExactExpert ¶
func (f *FilteredTermsEnumBase) SeekExactExpert(ctx context.Context, term []byte, state TermState) error
SeekExactExpert This enum does not support seeking! Throws: ErrUnsupportedOperation – In general, subclasses do not support seeking.
func (*FilteredTermsEnumBase) Term ¶
func (f *FilteredTermsEnumBase) Term() ([]byte, error)
func (*FilteredTermsEnumBase) TermState ¶
func (f *FilteredTermsEnumBase) TermState() (TermState, error)
TermState Returns the filtered enums term state
func (*FilteredTermsEnumBase) TotalTermFreq ¶
func (f *FilteredTermsEnumBase) TotalTermFreq() (int64, error)
type FindSegmentsFile ¶
type FindSegmentsFile struct { DoBody func(segmentFileName string) (any, error) // contains filtered or unexported fields }
FindSegmentsFile Utility class for executing code that needs to do something with the current segments file. This is necessary with lock-less commits because from the time you locate the current segments file name, until you actually open it, read its contents, or check modified time, etc., it could have been deleted due to a writer commit finishing.
func NewFindSegmentsFile ¶
func NewFindSegmentsFile(directory store.Directory) *FindSegmentsFile
func (*FindSegmentsFile) Run ¶
func (f *FindSegmentsFile) Run() (any, error)
func (*FindSegmentsFile) RunV1 ¶
func (f *FindSegmentsFile) RunV1(commit IndexCommit) (any, error)
type FinishedSegments ¶
FinishedSegments Tracks the contiguous range of packets that have finished resolving. We need this because the packets are concurrently resolved, and we can only write to disk the contiguous completed packets.
func NewFinishedSegments ¶
func NewFinishedSegments() *FinishedSegments
func (*FinishedSegments) Clear ¶
func (f *FinishedSegments) Clear()
func (*FinishedSegments) GetCompletedDelGen ¶
func (f *FinishedSegments) GetCompletedDelGen() int64
type FloatComparableProvider ¶
type FloatComparableProvider struct {
// contains filtered or unexported fields
}
func (*FloatComparableProvider) GetAsComparableLong ¶
func (r *FloatComparableProvider) GetAsComparableLong(docID int) (int64, error)
type FloatDocComparator ¶
type FloatDocComparator struct {
// contains filtered or unexported fields
}
func (*FloatDocComparator) Compare ¶
func (f *FloatDocComparator) Compare(docID1, docID2 int) int
type FloatSorter ¶
type FloatSorter struct {
// contains filtered or unexported fields
}
FloatSorter Sorts documents based on float values from a NumericDocValues instance
func NewFloatSorter ¶
func NewFloatSorter(providerName string, missingValue float32, reverse bool, valuesProvider NumericDocValuesProvider) *FloatSorter
func (*FloatSorter) GetComparableProviders ¶
func (f *FloatSorter) GetComparableProviders(readers []LeafReader) ([]ComparableProvider, error)
func (*FloatSorter) GetDocComparator ¶
func (f *FloatSorter) GetDocComparator(reader LeafReader, maxDoc int) (DocComparator, error)
func (*FloatSorter) GetProviderName ¶
func (f *FloatSorter) GetProviderName() string
type FlushNotifications ¶
type FlushNotifications interface { // DeleteUnusedFiles Called when files were written to disk that are not used anymore. It's the implementation's // responsibility to clean these files up DeleteUnusedFiles(files map[string]struct{}) // FlushFailed Called when a segment failed to Flush. FlushFailed(info *SegmentInfo) // AfterSegmentsFlushed Called after one or more segments were flushed to disk. AfterSegmentsFlushed() error // OnDeletesApplied Called once deletes have been applied either after a Flush or on a deletes call OnDeletesApplied() // OnTicketBacklog Called once the DocumentsWriter ticket queue has a backlog. This means there // is an inner thread that tries to publish flushed segments but can't keep up with the other // threads flushing new segments. This likely requires other thread to forcefully purge the buffer // to help publishing. This can't be done in-place since we might hold index writer locks when // this is called. The caller must ensure that the purge happens without an index writer lock being held. // See Also: purgeFlushTickets(boolean, IOUtils.IOConsumer) OnTicketBacklog() }
type FlushPolicy ¶
type FlushPolicy interface { }
type FlushTicket ¶
type FlushTicket struct {
// contains filtered or unexported fields
}
type FreqProxFields ¶
type FreqProxFields struct {
// contains filtered or unexported fields
}
func NewFreqProxFields ¶
func NewFreqProxFields(fieldList []*FreqProxTermsWriterPerField) *FreqProxFields
func (*FreqProxFields) Names ¶
func (f *FreqProxFields) Names() []string
func (*FreqProxFields) Size ¶
func (f *FreqProxFields) Size() int
type FreqProxPostingsArray ¶
type FreqProxPostingsArray struct { *ParallelPostingsArrayDefault // contains filtered or unexported fields }
func NewFreqProxPostingsArray ¶
func NewFreqProxPostingsArray(writeFreqs, writeProx, writeOffsets bool) *FreqProxPostingsArray
func (*FreqProxPostingsArray) BytesPerPosting ¶
func (f *FreqProxPostingsArray) BytesPerPosting() int
func (*FreqProxPostingsArray) NewInstance ¶
func (f *FreqProxPostingsArray) NewInstance() ParallelPostingsArray
func (*FreqProxPostingsArray) SetLastDocCodes ¶
func (f *FreqProxPostingsArray) SetLastDocCodes(termID, v int)
func (*FreqProxPostingsArray) SetLastDocIDs ¶
func (f *FreqProxPostingsArray) SetLastDocIDs(termID, v int)
func (*FreqProxPostingsArray) SetLastOffsets ¶
func (f *FreqProxPostingsArray) SetLastOffsets(termID, v int)
func (*FreqProxPostingsArray) SetLastPositions ¶
func (f *FreqProxPostingsArray) SetLastPositions(termID, v int)
func (*FreqProxPostingsArray) SetTermFreqs ¶
func (f *FreqProxPostingsArray) SetTermFreqs(termID, v int)
type FreqProxTerms ¶
type FreqProxTerms struct {
// contains filtered or unexported fields
}
func NewFreqProxTerms ¶
func NewFreqProxTerms(terms *FreqProxTermsWriterPerField) *FreqProxTerms
func (*FreqProxTerms) GetDocCount ¶
func (f *FreqProxTerms) GetDocCount() (int, error)
func (*FreqProxTerms) GetMax ¶
func (f *FreqProxTerms) GetMax() ([]byte, error)
func (*FreqProxTerms) GetMin ¶
func (f *FreqProxTerms) GetMin() ([]byte, error)
func (*FreqProxTerms) GetSumDocFreq ¶
func (f *FreqProxTerms) GetSumDocFreq() (int64, error)
func (*FreqProxTerms) GetSumTotalTermFreq ¶
func (f *FreqProxTerms) GetSumTotalTermFreq() (int64, error)
func (*FreqProxTerms) HasFreqs ¶
func (f *FreqProxTerms) HasFreqs() bool
func (*FreqProxTerms) HasOffsets ¶
func (f *FreqProxTerms) HasOffsets() bool
func (*FreqProxTerms) HasPayloads ¶
func (f *FreqProxTerms) HasPayloads() bool
func (*FreqProxTerms) HasPositions ¶
func (f *FreqProxTerms) HasPositions() bool
func (*FreqProxTerms) Intersect ¶
func (f *FreqProxTerms) Intersect(compiled *automaton.CompiledAutomaton, startTerm []byte) (TermsEnum, error)
func (*FreqProxTerms) Iterator ¶
func (f *FreqProxTerms) Iterator() (TermsEnum, error)
func (*FreqProxTerms) Size ¶
func (f *FreqProxTerms) Size() (int, error)
type FreqProxTermsEnum ¶
type FreqProxTermsEnum struct { *BaseTermsEnum // contains filtered or unexported fields }
func NewFreqProxTermsEnum ¶
func NewFreqProxTermsEnum(terms *FreqProxTermsWriterPerField) *FreqProxTermsEnum
func (*FreqProxTermsEnum) DocFreq ¶
func (f *FreqProxTermsEnum) DocFreq() (int, error)
func (*FreqProxTermsEnum) Impacts ¶
func (f *FreqProxTermsEnum) Impacts(flags int) (ImpactsEnum, error)
func (*FreqProxTermsEnum) Ord ¶
func (f *FreqProxTermsEnum) Ord() (int64, error)
func (*FreqProxTermsEnum) Postings ¶
func (f *FreqProxTermsEnum) Postings(reuse PostingsEnum, flags int) (PostingsEnum, error)
func (*FreqProxTermsEnum) SeekCeil ¶
func (f *FreqProxTermsEnum) SeekCeil(ctx context.Context, text []byte) (SeekStatus, error)
func (*FreqProxTermsEnum) SeekExactByOrd ¶
func (f *FreqProxTermsEnum) SeekExactByOrd(ctx context.Context, ord int64) error
func (*FreqProxTermsEnum) Term ¶
func (f *FreqProxTermsEnum) Term() ([]byte, error)
func (*FreqProxTermsEnum) TotalTermFreq ¶
func (f *FreqProxTermsEnum) TotalTermFreq() (int64, error)
type FreqProxTermsWriter ¶
type FreqProxTermsWriter struct {
*BaseTermsHash
}
func NewFreqProxTermsWriter ¶
func NewFreqProxTermsWriter(intBlockAllocator ints.IntsAllocator, byteBlockAllocator bytesref.Allocator, nextTermsHash TermsHash) *FreqProxTermsWriter
func (*FreqProxTermsWriter) AddField ¶
func (f *FreqProxTermsWriter) AddField(invertState *FieldInvertState, fieldInfo *document.FieldInfo) (TermsHashPerField, error)
func (*FreqProxTermsWriter) Flush ¶
func (f *FreqProxTermsWriter) Flush(fieldsToFlush map[string]TermsHashPerField, state *SegmentWriteState, sortMap *DocMap, norms NormsProducer) error
func (*FreqProxTermsWriter) SetTermBytePool ¶
func (f *FreqProxTermsWriter) SetTermBytePool(termBytePool *bytesref.BlockPool)
type FreqProxTermsWriterPerField ¶
type FreqProxTermsWriterPerField struct { *TermsHashPerFieldDefault // contains filtered or unexported fields }
func NewFreqProxTermsWriterPerField ¶
func NewFreqProxTermsWriterPerField(invertState *FieldInvertState, termsHash TermsHash, fieldInfo *document.FieldInfo, nextPerField TermsHashPerField) (*FreqProxTermsWriterPerField, error)
func (*FreqProxTermsWriterPerField) AddTerm ¶
func (f *FreqProxTermsWriterPerField) AddTerm(termID, docID int) error
func (*FreqProxTermsWriterPerField) CreatePostingsArray ¶
func (f *FreqProxTermsWriterPerField) CreatePostingsArray(size int) ParallelPostingsArray
func (*FreqProxTermsWriterPerField) Finish ¶
func (f *FreqProxTermsWriterPerField) Finish() error
func (*FreqProxTermsWriterPerField) NewPostingsArray ¶
func (f *FreqProxTermsWriterPerField) NewPostingsArray()
func (*FreqProxTermsWriterPerField) NewTerm ¶
func (f *FreqProxTermsWriterPerField) NewTerm(termID, docID int) error
func (*FreqProxTermsWriterPerField) Start ¶
func (f *FreqProxTermsWriterPerField) Start(field document.IndexableField, first bool) bool
type FreqProxTermsWriterPerFields ¶
type FreqProxTermsWriterPerFields []*FreqProxTermsWriterPerField
func (FreqProxTermsWriterPerFields) Len ¶
func (p FreqProxTermsWriterPerFields) Len() int
func (FreqProxTermsWriterPerFields) Less ¶
func (p FreqProxTermsWriterPerFields) Less(i, j int) bool
func (FreqProxTermsWriterPerFields) Swap ¶
func (p FreqProxTermsWriterPerFields) Swap(i, j int)
type FrozenBufferedUpdates ¶
type FrozenBufferedUpdates struct { }
FrozenBufferedUpdates Holds buffered deletes and updates by term or query, once pushed. Pushed deletes/updates are write-once, so we shift to more memory efficient data structure to hold them. We don't hold docIDs because these are applied on flush.
type Impact ¶
type Impact struct { // Term frequency of the term in the document. Freq int // Norm factor of the document. Norm int64 }
Impact Per-document scoring factors.
type Impacts ¶
type Impacts interface { // NumLevels Return the number of levels on which we have impacts. // The returned item is always greater than 0 and may not always be the same, // even on a single postings list, depending on the current doc ID. NumLevels() int // GetDocIdUpTo Return the maximum inclusive doc ID until which the list of impacts // returned by getImpacts(int) is valid. This is a non-decreasing function of level. GetDocIdUpTo(level int) int // GetImpacts Return impacts on the given level. These impacts are sorted by increasing // frequency and increasing unsigned norm, and only valid until the doc ID returned by // getDocIdUpTo(int) for the same level, included. The returned list is never empty. // NOTE: There is no guarantee that these impacts actually appear in postings, only that // they trigger scores that are greater than or equal to the impacts that actually // appear in postings. GetImpacts(level int) []*Impact }
type ImpactsEnum ¶
type ImpactsEnum interface { PostingsEnum ImpactsSource }
ImpactsEnum Extension of PostingsEnum which also provides information about upcoming impacts.
type ImpactsSource ¶
type ImpactsSource interface { // AdvanceShallow Shallow-advance to target. This is cheaper than calling DocIdSetIterator.advance(int) // and allows further calls to getImpacts() to ignore doc IDs that are less than target in order to get // more precise information about impacts. This method may not be called on targets that are less than // the current DocIdSetIterator.docID(). After this method has been called, DocIdSetIterator.nextDoc() // may not be called if the current doc ID is less than target - 1 and DocIdSetIterator.advance(int) // may not be called on targets that are less than target. AdvanceShallow(target int) error // GetImpacts Get information about upcoming impacts for doc ids that are greater than or equal to the // maximum of DocIdSetIterator.docID() and the last target that was passed to advanceShallow(int). // This method may not be called on an unpositioned iterator on which advanceShallow(int) has never been // called. NOTE: advancing this iterator may invalidate the returned impacts, so they should not be used // after the iterator has been advanced. GetImpacts() (Impacts, error) }
ImpactsSource Source of Impacts.
type IndexCommit ¶
type IndexCommit interface { // GetSegmentsFileName Get the segments file (segments_N) associated with this commit point. GetSegmentsFileName() string // GetFileNames Returns all index files referenced by this commit point. GetFileNames() (map[string]struct{}, error) // GetDirectory Returns the Directory for the index. GetDirectory() store.Directory // Delete this commit point. This only applies when using the commit point in the context of // IndexWriter's IndexDeletionPolicy. // Upon calling this, the writer is notified that this commit point should be deleted. // Decision that a commit-point should be deleted is taken by the IndexDeletionPolicy in effect // and therefore this should only be called by its onInit() or onCommit() methods. Delete() error // IsDeleted Returns true if this commit should be deleted; // this is only used by IndexWriter after invoking the IndexDeletionPolicy. IsDeleted() bool // GetSegmentCount Returns number of segments referenced by this commit. GetSegmentCount() int // GetGeneration Returns the generation (the _N in segments_N) for this IndexCommit GetGeneration() int64 // GetUserData Returns userData, previously passed to IndexWriter.setLiveCommitData(Iterable) for this commit. // Map is String -> String. GetUserData() (map[string]string, error) CompareTo(commit IndexCommit) int // GetReader Package-private API for IndexWriter to init from a commit-point pulled from an NRT or non-NRT reader. GetReader() *StandardDirectoryReader }
IndexCommit Expert: represents a single commit into an index as seen by the IndexDeletionPolicy or Reader. Changes to the content of an index are made visible only after the writer who made that change commits by writing a new segments file (segments_N). This point in time, when the action of writing of a new segments file to the directory is completed, is an index commit.
Each index commit point has a unique segments file associated with it. The segments file associated with a later index commit point would have a larger N.
lucene.experimental
TODO: this is now a poor name, because this class also represents a point-in-time view from an NRT reader
type IndexCommits ¶
type IndexCommits []IndexCommit
func (IndexCommits) Len ¶
func (list IndexCommits) Len() int
func (IndexCommits) Less ¶
func (list IndexCommits) Less(i, j int) bool
func (IndexCommits) Swap ¶
func (list IndexCommits) Swap(i, j int)
type IndexDeletionPolicy ¶
type IndexDeletionPolicy interface { // OnInit This is called once when a writer is first instantiated to give the policy a chance to remove old commit points. // The writer locates all index commits present in the index directory and calls this method. The policy may choose to delete some of the commit points, doing so by calling method delete() of IndexCommit. // Note: the last CommitPoint is the most recent one, i.e. the "front index state". Be careful not to delete it, unless you know for sure what you are doing, and unless you can afford to lose the index content while doing that. // Params: commits – List of current point-in-time commits, sorted by age (the 0th one is the oldest commit). Note that for a new index this method is invoked with an empty list. OnInit(commits []IndexCommit) error OnCommit(commits []IndexCommit) error }
IndexDeletionPolicy Expert: policy for deletion of stale index commits. Implement this interface, and set it on IndexWriterConfig.setIndexDeletionPolicy(IndexDeletionPolicy) to customize when older point-in-time commits are deleted from the index directory. The default deletion policy is KeepOnlyLastCommitDeletionPolicy, always removes old commits as soon as a new commit is done (this matches the behavior before 2.2). One expected use case for this (and the reason why it was first created) is to work around problems with an index directory accessed via filesystems like NFS because NFS does not provide the "delete on last close" semantics that Lucene's "point in time" search normally relies on. By implementing a custom deletion policy, such as "a commit is only removed once it has been stale for more than X minutes", you can give your readers time to refresh to the new commit before IndexWriter removes the old commits. Note that doing so will increase the storage requirements of the index. See LUCENE-710 for details.
type IndexFileDeleter ¶
IndexFileDeleter This class keeps track of each SegmentInfos instance that is still "live", either because it corresponds to a segments_N file in the Directory (a "commit", i.e. a committed SegmentInfos) or because it's an in-memory SegmentInfos that a writer is actively updating but has not yet committed. This class uses simple reference counting to map the live SegmentInfos instances to individual files in the Directory.
The same directory file may be referenced by more than one IndexCommit, i.e. more than one SegmentInfos. Therefore we count how many commits reference each file. When all the commits referencing a certain file have been deleted, the refcount for that file becomes zero, and the file is deleted.
A separate deletion policy interface (IndexDeletionPolicy) is consulted on creation (onInit) and once per commit (onCommit), to decide when a commit should be removed.
It is the business of the IndexDeletionPolicy to choose when to delete commit points. The actual mechanics of file deletion, retrying, etc, derived from the deletion of commit points is the business of the IndexFileDeleter.
The current default deletion policy is {@link KeepOnlyLastCommitDeletionPolicy}, which removes all prior commits when a new commit has completed. This matches the behavior before 2.2.
Note that you must hold the write.lock before instantiating this class. It opens segments_N file(s) directly with no retry logic.
func NewIndexFileDeleter ¶
func NewIndexFileDeleter(ctx context.Context, files []string, directoryOrig, directory store.Directory, policy IndexDeletionPolicy, segmentInfos *SegmentInfos, writer *Writer, initialIndexExists, isReaderInit bool) (*IndexFileDeleter, error)
NewIndexFileDeleter Initialize the deleter: find all previous commits in the Directory, incref the files they reference, call the policy to let it delete commits. This will remove any files not referenced by any of the commits. Throws: IOException – if there is a low-level IO error
func (*IndexFileDeleter) Checkpoint ¶
func (r *IndexFileDeleter) Checkpoint(segmentInfos *SegmentInfos, isCommit bool) error
Checkpoint For definition of "check point" see IndexWriter comments: "Clarification: Check Points (and commits)". Writer calls this when it has made a "consistent change" to the index, meaning new files are written to the index and the in-memory SegmentInfos have been modified to point to those files. This may or may not be a commit (segments_N may or may not have been written). We simply incref the files referenced by the new SegmentInfos and decref the files we had previously seen (if any). If this is a commit, we also call the policy to give it a chance to remove other commits. If any commits are removed, we decref their files as well.
func (*IndexFileDeleter) DecRef ¶
func (r *IndexFileDeleter) DecRef(files map[string]struct{}) error
func (*IndexFileDeleter) IncRef ¶
func (r *IndexFileDeleter) IncRef(segmentInfos *SegmentInfos, isCommit bool) error
type IndexReaderContextDefault ¶
type IndexReaderContextDefault struct { // The reader context for this reader's immediate parent, or null if none Parent *CompositeReaderContext // true if this context struct represents the top level reader within the hierarchical context IsTopLevel bool // the doc base for this reader in the parent, 0 if parent is null DocBaseInParent int // the ord for this reader in the parent, 0 if parent is null OrdInParent int // contains filtered or unexported fields }
func NewIndexReaderContextDefault ¶
func NewIndexReaderContextDefault(parent *CompositeReaderContext, ordInParent, docBaseInParent int) *IndexReaderContextDefault
func (*IndexReaderContextDefault) Identity ¶
func (r *IndexReaderContextDefault) Identity() string
type IndexSorter ¶
type IndexSorter interface { // GetComparableProviders // Get an array of IndexSorter.ComparableProvider, one per segment, // for merge sorting documents in different segments // Params: readers – the readers to be merged GetComparableProviders(readers []LeafReader) ([]ComparableProvider, error) // GetDocComparator Get a comparator that determines the sort order of docs within a single Reader. // NB We cannot simply use the FieldComparator API because it requires docIDs to be sent in-order. // The default implementations allocate array[maxDoc] to hold native values for comparison, but 1) // they are transient (only alive while sorting this one segment) and 2) in the typical index // sorting case, they are only used to sort newly flushed segments, which will be smaller than // merged segments // // Params: reader – the Reader to sort // maxDoc – the number of documents in the Reader GetDocComparator(reader LeafReader, maxDoc int) (DocComparator, error) // GetProviderName The SPI-registered name of a SortFieldProvider that will deserialize the parent SortField GetProviderName() string }
IndexSorter Handles how documents should be sorted in an index, both within a segment and between segments. Implementers must provide the following methods: getDocComparator(LeafReader, int) - an object that determines how documents within a segment are to be sorted getComparableProviders(List) - an array of objects that return a sortable long item per document and segment getProviderName() - the SPI-registered name of a SortFieldProvider to serialize the sort The companion SortFieldProvider should be registered with SPI via META-INF/services
type IndexingChain ¶
type IndexingChain interface { GetChain(indexCreatedVersionMajor int, segmentInfo *SegmentInfo, directory store.Directory, fieldInfos *FieldInfosBuilder, indexWriterConfig *liveIndexWriterConfig) DocConsumer }
type IntComparableProvider ¶
type IntComparableProvider struct {
// contains filtered or unexported fields
}
func (*IntComparableProvider) GetAsComparableLong ¶
func (r *IntComparableProvider) GetAsComparableLong(docID int) (int64, error)
type IntDocComparator ¶
type IntDocComparator struct {
// contains filtered or unexported fields
}
func (*IntDocComparator) Compare ¶
func (r *IntDocComparator) Compare(docID1, docID2 int) int
type IntSorter ¶
type IntSorter struct {
// contains filtered or unexported fields
}
IntSorter Sorts documents based on integer values from a NumericDocValues instance
func NewIntSorter ¶
func NewIntSorter(providerName string, missingValue int32, reverse bool, valuesProvider NumericDocValuesProvider) *IntSorter
func (*IntSorter) GetComparableProviders ¶
func (i *IntSorter) GetComparableProviders(readers []LeafReader) ([]ComparableProvider, error)
func (*IntSorter) GetDocComparator ¶
func (i *IntSorter) GetDocComparator(reader LeafReader, maxDoc int) (DocComparator, error)
func (*IntSorter) GetProviderName ¶
type LeafAndDocID ¶
type LeafAndDocID struct {
// contains filtered or unexported fields
}
func NewLeafAndDocID ¶
type LeafFieldComparator ¶
type LeafFieldComparator interface { // SetBottom Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When compareBottom is called, you should compare against this slot. This will always be called before compareBottom. // Params: slot – the currently weakest (sorted last) slot in the queue SetBottom(slot int) error // CompareBottom compare the bottom of the queue with this doc. This will only invoked after setBottom has // been called. This should return the same result as FieldComparator.compare(int, int)} as if bottom were // slot1 and the new document were slot 2. // For a search that hits many results, this method will be the hotspot (invoked by far the most frequently). // Params: doc – that was hit // Returns: any N < 0 if the doc's item is sorted after the bottom entry (not competitive), any N > 0 if // the doc's item is sorted before the bottom entry and 0 if they are equal. CompareBottom(doc int) (int, error) // CompareTop compare the top item with this doc. This will only invoked after setTopValue has been called. // This should return the same result as FieldComparator.compare(int, int)} as if topValue were slot1 and // the new document were slot 2. This is only called for searches that use searchAfter (deep paging). // Params: doc – that was hit // Returns: any N < 0 if the doc's item is sorted after the top entry (not competitive), any N > 0 if the // doc's item is sorted before the top entry and 0 if they are equal. CompareTop(doc int) (int, error) // Copy This method is called when a new hit is competitive. // You should copy any state associated with this document that will be required for future comparisons, // into the specified slot. // Params: slot – which slot to copy the hit to // doc – docID relative to current reader Copy(slot, doc int) error // SetScorer Sets the Scorer to use in case a document's score is needed. // Params: scorer – Scorer instance that you should use to obtain the current hit's score, if necessary. SetScorer(scorer Scorable) error // CompetitiveIterator Returns a competitive iterator // Returns: an iterator over competitive docs that are stronger than already collected docs or // null if such an iterator is not available for the current comparator or segment. CompetitiveIterator() (types.DocIdSetIterator, error) // SetHitsThresholdReached Informs this leaf comparator that hits threshold is reached. // This method is called from a collector when hits threshold is reached. SetHitsThresholdReached() error }
LeafFieldComparator Expert: comparator that gets instantiated on each leaf from a top-level FieldComparator instance. A leaf comparator must define these functions: setBottom This method is called by FieldValueHitQueue to notify the FieldComparator of the current weakest ("bottom") slot. Note that this slot may not hold the weakest item according to your comparator, in cases where your comparator is not the primary one (ie, is only used to break ties from the comparators before it). compareBottom Compare a new hit (docID) against the "weakest" (bottom) entry in the queue. compareTop Compare a new hit (docID) against the top item previously set by a call to FieldComparator.setTopValue. copy Installs a new hit into the priority queue. The FieldValueHitQueue calls this method when a new hit is competitive. See Also: FieldComparator lucene.experimental
type LeafMetaData ¶
type LeafMetaData struct {
// contains filtered or unexported fields
}
LeafMetaData Provides read-only metadata about a leaf.
func NewLeafMetaData ¶
func NewLeafMetaData(createdVersionMajor int, minVersion *version.Version, sort *Sort) *LeafMetaData
func (*LeafMetaData) GetSort ¶
func (l *LeafMetaData) GetSort() *Sort
type LeafReader ¶
type LeafReader interface { Reader // Terms Returns the Terms index for this field, or null if it has none. Terms(field string) (Terms, error) // Postings Returns PostingsEnum for the specified term. This will return null if either the field or // term does not exist. // NOTE: The returned PostingsEnum may contain deleted docs. // See Also: TermsEnum.postings(PostingsEnum) Postings(ctx context.Context, term *Term, flags int) (PostingsEnum, error) // GetNumericDocValues Returns NumericDocValues for this field, or null if no numeric doc values were // indexed for this field. The returned instance should only be used by a single thread. GetNumericDocValues(field string) (NumericDocValues, error) // GetBinaryDocValues Returns BinaryDocValues for this field, or null if no binary doc values were indexed // for this field. The returned instance should only be used by a single thread. GetBinaryDocValues(field string) (BinaryDocValues, error) // GetSortedDocValues Returns SortedDocValues for this field, or null if no SortedDocValues were indexed // for this field. The returned instance should only be used by a single thread. GetSortedDocValues(field string) (SortedDocValues, error) // GetSortedNumericDocValues Returns SortedNumericDocValues for this field, or null if no // SortedNumericDocValues were indexed for this field. The returned instance should only be used by a single thread. GetSortedNumericDocValues(field string) (SortedNumericDocValues, error) // GetSortedSetDocValues Returns SortedSetDocValues for this field, or null if no SortedSetDocValues // were indexed for this field. The returned instance should only be used by a single thread. GetSortedSetDocValues(field string) (SortedSetDocValues, error) // GetNormValues Returns NumericDocValues representing norms for this field, or null if no NumericDocValues // were indexed. The returned instance should only be used by a single thread. GetNormValues(field string) (NumericDocValues, error) // GetFieldInfos Get the FieldInfos describing all fields in this reader. Note: Implementations // should cache the FieldInfos instance returned by this method such that subsequent calls to // this method return the same instance. GetFieldInfos() *FieldInfos // GetLiveDocs Returns the Bits representing live (not deleted) docs. A set bit indicates the doc ID has // not been deleted. If this method returns null it means there are no deleted documents // (all documents are live). The returned instance has been safely published for use by multiple threads // without additional synchronization. GetLiveDocs() util.Bits // GetPointValues Returns the PointValues used for numeric or spatial searches for the given field, or null // if there are no point fields. GetPointValues(field string) (types.PointValues, bool) // CheckIntegrity Checks consistency of this reader. // Note that this may be costly in terms of I/O, e.g. may involve computing a checksum item against large data files. CheckIntegrity() error // GetMetaData Return metadata about this leaf. GetMetaData() *LeafMetaData }
type LeafReaderBaseInner ¶
type LeafReaderContext ¶
type LeafReaderContext struct { *IndexReaderContextDefault // The reader's ord in the top-level's leaves array Ord int // The reader's absolute doc base DocBase int // contains filtered or unexported fields }
LeafReaderContext ReaderContext for LeafReader instances.
func NewLeafReaderContext ¶
func NewLeafReaderContext(leafReader LeafReader) *LeafReaderContext
func NewLeafReaderContextV1 ¶
func NewLeafReaderContextV1(parent *CompositeReaderContext, reader LeafReader, ord, docBase, leafOrd, leafDocBase int) *LeafReaderContext
func (*LeafReaderContext) Children ¶
func (l *LeafReaderContext) Children() []ReaderContext
func (*LeafReaderContext) Identity ¶
func (l *LeafReaderContext) Identity() string
func (*LeafReaderContext) LeafReader ¶
func (l *LeafReaderContext) LeafReader() LeafReader
func (*LeafReaderContext) Leaves ¶
func (l *LeafReaderContext) Leaves() ([]*LeafReaderContext, error)
func (*LeafReaderContext) Reader ¶
func (l *LeafReaderContext) Reader() Reader
type LiveDocsFormat ¶
type LiveDocsFormat interface { // ReadLiveDocs Read live docs bits. ReadLiveDocs(dir store.Directory, info *SegmentCommitInfo, context *store.IOContext) (util.Bits, error) // WriteLiveDocs Persist live docs bits. Use SegmentCommitInfo.getNextDelGen to determine // the generation of the deletes file you should write to. WriteLiveDocs(bits util.Bits, dir store.Directory, info *SegmentCommitInfo, newDelCount int, context *store.IOContext) error // Files Records all files in use by this SegmentCommitInfo into the files argument. Files(info *SegmentCommitInfo, files map[string]struct{}) (map[string]struct{}, error) }
type LiveIndexWriterConfig ¶
type LiveIndexWriterConfig interface { GetAnalyzer() analysis.Analyzer SetMaxBufferedDocs(maxBufferedDocs int) // GetMaxBufferedDocs Returns the number of buffered added documents that will trigger a flush if enabled. // See Also: setMaxBufferedDocs(int) GetMaxBufferedDocs() int // SetMergePolicy Expert: MergePolicy is invoked whenever there are changes to the segments in the index. // Its role is to select which merges to do, if any, and return a MergePolicy.MergeSpecification // describing the merges. It also selects merges to do for forceMerge. // Takes effect on subsequent merge selections. Any merges in flight or any merges already registered by // the previous MergePolicy are not affected. SetMergePolicy(mergePolicy MergePolicy) // SetMergedSegmentWarmer Set the merged segment warmer. See IndexWriter.ReaderWarmer. //Takes effect on the next merge. SetMergedSegmentWarmer(mergeSegmentWarmer ReaderWarmer) // GetMergedSegmentWarmer Returns the current merged segment warmer. See IndexWriter.ReaderWarmer. GetMergedSegmentWarmer() ReaderWarmer // GetIndexCreatedVersionMajor Return the compatibility version to use for this index. // See Also: IndexWriterConfig.setIndexCreatedVersionMajor GetIndexCreatedVersionMajor() int // GetIndexDeletionPolicy Returns the IndexDeletionPolicy specified in // IndexWriterConfig.setIndexDeletionPolicy(IndexDeletionPolicy) or the default KeepOnlyLastCommitDeletionPolicy/ GetIndexDeletionPolicy() IndexDeletionPolicy // GetIndexCommit Returns the IndexCommit as specified in IndexWriterConfig.setIndexCommit(IndexCommit) or the // default, null which specifies to open the latest index commit point. GetIndexCommit() IndexCommit // GetSimilarity Expert: returns the Similarity implementation used by this IndexWriter. GetSimilarity() Similarity // GetMergeScheduler Returns the MergeScheduler that was set by IndexWriterConfig.setMergeScheduler(MergeScheduler). GetMergeScheduler() MergeScheduler // GetCodec Returns the current Codec. GetCodec() Codec // GetMergePolicy Returns the current MergePolicy in use by this writer. // See Also: IndexWriterConfig.setMergePolicy(MergePolicy) GetMergePolicy() MergePolicy // GetReaderPooling Returns true if IndexWriter should pool readers even if // DirectoryReader.open(IndexWriter) has not been called. GetReaderPooling() bool // GetIndexingChain Returns the indexing chain. GetIndexingChain() IndexingChain // GetFlushPolicy See Also: //IndexWriterConfig.setFlushPolicy(FlushPolicy) GetFlushPolicy() FlushPolicy // SetUseCompoundFile Sets if the IndexWriter should pack newly written segments in a compound file. // Default is true. // Use false for batch indexing with very large ram buffer settings. // Note: To control compound file usage during segment merges see MergePolicy.setNoCFSRatio(double) // and MergePolicy.setMaxCFSSegmentSizeMB(double). This setting only applies to newly created segments. SetUseCompoundFile(useCompoundFile bool) // GetUseCompoundFile Returns true iff the IndexWriter packs newly written segments in a compound file. // Default is true. GetUseCompoundFile() bool // GetCommitOnClose Returns true if IndexWriter.close() should first commit before closing. GetCommitOnClose() bool // GetIndexSort Get the index-time Sort order, applied to all (flushed and merged) segments. GetIndexSort() *Sort // GetIndexSortFields Returns the field names involved in the index sort GetIndexSortFields() map[string]struct{} // GetLeafSorter Returns a comparator for sorting leaf readers. If not null, this comparator is // used to sort leaf readers within DirectoryReader opened from the IndexWriter of this configuration. // Returns: a comparator for sorting leaf readers GetLeafSorter() func(a, b LeafReader) int // IsCheckPendingFlushOnUpdate Expert: Returns if indexing threads check for pending flushes on update //in order to help our flushing indexing buffers to disk //lucene.experimental IsCheckPendingFlushOnUpdate() bool // SetCheckPendingFlushUpdate Expert: sets if indexing threads check for pending flushes on update // in order to help our flushing indexing buffers to disk. As a consequence, threads calling // DirectoryReader.openIfChanged(DirectoryReader, IndexWriter) or IndexWriter.flush() will be the // only thread writing segments to disk unless flushes are falling behind. If indexing is stalled due // to too many pending flushes indexing threads will help our writing pending segment flushes to disk. //lucene.experimental SetCheckPendingFlushUpdate(checkPendingFlushOnUpdate bool) // GetSoftDeletesField Returns the soft deletes field or null if soft-deletes are disabled. // See IndexWriterConfig.setSoftDeletesField(String) for details. GetSoftDeletesField() string // GetMaxFullFlushMergeWaitMillis Expert: return the amount of time to wait for merges returned by // by MergePolicy.findFullFlushMerges(...). If this time is reached, we proceed with the commit // based on segments merged up to that point. The merges are not cancelled, and may still run to // completion independent of the commit. GetMaxFullFlushMergeWaitMillis() int64 GetOpenMode() OpenMode }
type LogByteSizeMergePolicy ¶
type LogByteSizeMergePolicy struct { }
LogByteSizeMergePolicy This is a LogMergePolicy that measures size of a segment as the total byte size of the segment's files.
type LongComparableProvider ¶
type LongComparableProvider struct {
// contains filtered or unexported fields
}
func (*LongComparableProvider) GetAsComparableLong ¶
func (r *LongComparableProvider) GetAsComparableLong(docID int) (int64, error)
type LongDocComparator ¶
type LongDocComparator struct {
// contains filtered or unexported fields
}
func (*LongDocComparator) Compare ¶
func (r *LongDocComparator) Compare(docID1, docID2 int) int
type LongSorter ¶
type LongSorter struct {
// contains filtered or unexported fields
}
LongSorter Sorts documents based on long values from a NumericDocValues instance
func NewLongSorter ¶
func NewLongSorter(providerName string, missingValue int64, reverse bool, valuesProvider NumericDocValuesProvider) *LongSorter
func (*LongSorter) GetComparableProviders ¶
func (i *LongSorter) GetComparableProviders(readers []LeafReader) ([]ComparableProvider, error)
func (*LongSorter) GetDocComparator ¶
func (i *LongSorter) GetDocComparator(reader LeafReader, maxDoc int) (DocComparator, error)
func (*LongSorter) GetProviderName ¶
func (i *LongSorter) GetProviderName() string
type MergeContext ¶
type MergeContext interface { // NumDeletesToMerge Returns the number of deletes a merge would claim back if the given segment is merged. // Params: info – the segment to get the number of deletes for // See Also: numDeletesToMerge(SegmentCommitInfo, int, IOSupplier) NumDeletesToMerge(info *SegmentCommitInfo) (int, error) // NumDeletedDocs Returns the number of deleted documents in the given segments. NumDeletedDocs(info *SegmentCommitInfo) int // GetMergingSegments Returns an unmodifiable set of segments that are currently merging. GetMergingSegments() []*SegmentCommitInfo }
MergeContext This interface represents the current context of the merge selection process. It allows to access real-time information like the currently merging segments or how many deletes a segment would claim back if merged. This context might be stateful and change during the execution of a merge policy's selection processes. lucene.experimental
type MergePolicy ¶
type MergePolicy interface { // FindMerges // Determine what set of merge operations are now necessary on the index. // IndexWriter calls this whenever there is a change to the segments. // This call is always synchronized on the IndexWriter instance so only one thread at a time will call this method. // mergeTrigger: the event that triggered the merge // segmentInfos: the total set of segments in the index // mergeContext: the IndexWriter to find the merges on FindMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error) // FindForcedMerges Determine what set of merge operations is necessary in order to // merge to <= the specified segment count. // IndexWriter calls this when its IndexWriter.forceMerge method is called. // This call is always synchronized on the IndexWriter instance so only one // thread at a time will call this method. // // FindForcedMerges确定需要哪一组合并操作才能合并到<=指定的段计数。 // IndexWriter在调用其IndexWriter.forceMerge方法时调用此函数。 // 此调用始终在IndexWriter实例上同步,因此一次只有一个线程会调用此方法 // // Params: // segmentInfos – the total set of segments in the index // maxSegmentCount – requested maximum number of segments in the index (currently this is always 1) // segmentsToMerge – contains the specific SegmentInfo instances that must be merged away. // This may be a subset of all SegmentInfos. If the item is True for a given SegmentInfo, // that means this segment was an original segment present in the to-be-merged index; // else, it was a segment produced by a cascaded merge. // mergeContext – the MergeContext to find the merges on FindForcedMerges(segmentInfos *SegmentInfos, maxSegmentCount int, segmentsToMerge map[*SegmentCommitInfo]bool, mergeContext MergeContext) (*MergeSpecification, error) // FindForcedDeletesMerges // Determine what set of merge operations is necessary in order to expunge all deletes from the index. // // 确定需要哪一组合并操作才能从索引中删除所有删除。 // // Params: // segmentInfos – the total set of segments in the index // mergeContext – the MergeContext to find the merges on FindForcedDeletesMerges(segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error) // FindFullFlushMerges // Identifies merges that we want to execute (synchronously) on commit. // By default, this will do no merging on commit. If you implement this method in your MergePolicy you // must also set a non-zero timeout using IndexWriterConfig.setMaxFullFlushMergeWaitMillis. // Any merges returned here will make IndexWriter.commit(), IndexWriter.prepareCommit() or // IndexWriter.getReader(boolean, boolean) block until the merges complete or until // IndexWriterConfig.getMaxFullFlushMergeWaitMillis() has elapsed. // This may be used to merge small segments that have just been flushed, reducing the number of // segments in the point in time snapshot. If a merge does not complete in the allotted time, // it will continue to execute, and eventually finish and apply to future point in time snapshot, // but will not be reflected in the current one. If a MergePolicy.OneMerge in the returned // MergePolicy.MergeSpecification includes a segment already included in a registered merge, // then IndexWriter.commit() or IndexWriter.prepareCommit() will throw a IllegalStateException. // Use MergePolicy.MergeContext.getMergingSegments() to determine which segments are currently // registered to merge. // // 标识我们要在提交时(同步)执行的合并。默认情况下,这将不会在提交时进行合并。 // 如果在MergePolicy中实现此方法,则还必须使用IndexWriterConfig.setMaxFullFlushMergeWaitMillis设置非零超时。 // 此处返回的任何合并都将导致IndexWriter.commit()、IndexWriter.prepareCommit() // 或IndexWriter.getReader(布尔值、布尔值)阻塞,直到合并完成或IndexWriter // Config.getMaxFullFlushMergeWaitMillis()结束。这可以用于合并刚刚刷新的小片段, // 从而减少时间点快照中的片段数量。如果合并没有在分配的时间内完成,它将继续执行, // 最终完成并应用于未来的时间点快照,但不会反映在当前快照中。如果返回的 // MergePolicy.MergeSpecification中的MergePolicy.OneMerge包含已包含在注册合并中的段,则IndexWriter.commit() // 或IndexWriter.prepareCommit()将引发IllegalStateException。 // 使用MergePolicy.MergeContext.getMergingSegments()确定当前要注册合并的段。 // // Params: // mergeTrigger – the event that triggered the merge (COMMIT or GET_READER). // segmentInfos – the total set of segments in the index (while preparing the commit) // mergeContext – the MergeContext to find the merges on, which should be used to // determine which segments are already in a registered merge // (see MergePolicy.MergeContext.getMergingSegments()). FindFullFlushMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error) // UseCompoundFile // Returns true if a new segment (regardless of its origin) should use the compound file format. // The default implementation returns true iff the size of the given mergedInfo is less or equal // to getMaxCFSSegmentSizeMB() and the size is less or equal to the TotalIndexSize * getNoCFSRatio() // otherwise false. // // 如果新段(无论其来源如何)应使用复合文件格式,则返回true。 // 如果给定mergedInfo的大小小于或等于getMaxCFSSegmentSizeMB(), // 并且大小小于或相等于TotalIndexSize*getNoCFSRatio(),则默认实现返回true,否则为false。 UseCompoundFile(infos *SegmentInfos, mergedInfo *SegmentCommitInfo, mergeContext MergeContext) (bool, error) KeepFullyDeletedSegment(func() CodecReader) bool MergePolicyInner }
MergePolicy Expert: a MergePolicy determines the sequence of primitive merge operations. Whenever the segments in an index have been altered by IndexWriter, either the addition of a newly flushed segment, addition of many segments from addIndexes* calls, or a previous merge that may now need to cascade, IndexWriter invokes findMerges to give the MergePolicy a chance to pick merges that are now required. This method returns a MergePolicy.MergeSpecification instance describing the set of merges that should be done, or null if no merges are necessary. When IndexWriter.forceMerge is called, it calls findForcedMerges(SegmentInfos, int, Map, MergePolicy.MergeContext) and the MergePolicy should then return the necessary merges.
Note that the policy can return more than one merge at a time. In this case, if the writer is using SerialMergeScheduler, the merges will be run sequentially but if it is using ConcurrentMergeScheduler they will be run concurrently.
The default MergePolicy is TieredMergePolicy.
lucene.experimental
type MergePolicyBase ¶
type MergePolicyBase struct { MergePolicyInner // contains filtered or unexported fields }
func NewMergePolicy ¶
func NewMergePolicy(inner MergePolicyInner) *MergePolicyBase
func (*MergePolicyBase) FindFullFlushMerges ¶
func (m *MergePolicyBase) FindFullFlushMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
func (*MergePolicyBase) KeepFullyDeletedSegment ¶
func (m *MergePolicyBase) KeepFullyDeletedSegment(func() CodecReader) bool
func (*MergePolicyBase) UseCompoundFile ¶
func (m *MergePolicyBase) UseCompoundFile(infos *SegmentInfos, mergedInfo *SegmentCommitInfo, mergeContext MergeContext) (bool, error)
type MergePolicyInner ¶
type MergePolicyInner interface { Size(info *SegmentCommitInfo, mergeContext MergeContext) (int64, error) GetNoCFSRatio() float64 }
type MergeScheduler ¶
type MergeScheduler interface { io.Closer // Merge Run the merges provided by MergeScheduler.MergeSource.getNextMerge(). // Params: // mergeSource – the IndexWriter to obtain the merges from. // trigger – the MergeTrigger that caused this merge to happen Merge(mergeSource MergeSource, trigger MergeTrigger) error // Initialize IndexWriter calls this on init. Initialize(dir store.Directory) }
MergeScheduler Expert: IndexWriter uses an instance implementing this interface to execute the merges selected by a MergePolicy. The default MergeScheduler is ConcurrentMergeScheduler. lucene.experimental
type MergeSource ¶
type MergeSource interface { // GetNextMerge // The MergeScheduler calls this method to retrieve the next merge requested by the MergePolicy GetNextMerge() (*OneMerge, error) // OnMergeFinished // Does finishing for a merge. OnMergeFinished(merge *OneMerge) error // HasPendingMerges // Expert: returns true if there are merges waiting to be scheduled. HasPendingMerges() bool // Merge // merges the indicated segments, replacing them in the stack with a single segment. Merge(merge *OneMerge) error }
type MergeSpecification ¶
type MergeSpecification struct {
// contains filtered or unexported fields
}
A MergeSpecification instance provides the information necessary to perform multiple merges. It simply contains a list of MergePolicy.OneMerge instances.
func NewMergeSpecification ¶
func NewMergeSpecification() *MergeSpecification
NewMergeSpecification Sole constructor. Use add(MergePolicy.OneMerge) to add merges.
func (*MergeSpecification) Add ¶
func (m *MergeSpecification) Add(merge *OneMerge)
type MergeState ¶
type MergeState struct { // Maps document IDs from old segments to document IDs in the new segment DocMaps []MergeStateDocMap // SegmentInfo of the newly merged segment. SegmentInfo *SegmentInfo // FieldInfos of the newly merged segment. MergeFieldInfos *FieldInfos // Stored field producers being merged StoredFieldsReaders []StoredFieldsReader // Term vector producers being merged TermVectorsReaders []TermVectorsReader // Norms producers being merged NormsProducers []NormsProducer // DocValues producers being merged DocValuesProducers []DocValuesProducer // FieldInfos being merged FieldInfos []*FieldInfos // Live docs for each reader LiveDocs []util.Bits // Postings to merge FieldsProducers []FieldsProducer // Point readers to merge PointsReaders []PointsReader // Max docs per reader MaxDocs []int // Indicates if the index needs to be sorted NeedsIndexSort bool }
MergeState Holds common state used during segment merging.
func NewMergeState ¶
func NewMergeState(readers []CodecReader, segmentInfo *SegmentInfo) (*MergeState, error)
type MergeStateDocMap ¶
func SortCodecReader ¶
func SortCodecReader(sort *Sort, readers []CodecReader) ([]MergeStateDocMap, error)
SortCodecReader Does a merge sort of the leaves of the incoming reader, returning MergeState.DocMap to map each leaf's documents into the merged segment. The documents for each incoming leaf reader must already be sorted by the same sort! Returns null if the merge sort is not needed (segments are already in index sort order).
type MergeTrigger ¶
type MergeTrigger int
type MultiLevelSkipListReader ¶
type MultiLevelSkipListReader interface { // ReadSkipData Subclasses must implement the actual skip data encoding in this method. // level: the level skip data shall be read from // skipStream: the skip stream to read from ReadSkipData(level int, skipStream store.IndexInput) (int, error) }
MultiLevelSkipListReader This interface reads skip lists with multiple levels. See MultiLevelSkipListWriter for the information about the encoding of the multi level skip lists. Subclasses must implement the abstract method readSkipData(int, IndexInput) which defines the actual format of the skip data.
type MultiLevelSkipListReaderDefault ¶
type MultiLevelSkipListReaderDefault struct {
// contains filtered or unexported fields
}
func NewMultiLevelSkipListReaderDefault ¶
func NewMultiLevelSkipListReaderDefault(skipStream store.IndexInput, maxSkipLevels, skipInterval, skipMultiplier int) *MultiLevelSkipListReaderDefault
func (*MultiLevelSkipListReaderDefault) Close ¶
func (m *MultiLevelSkipListReaderDefault) Close() error
func (*MultiLevelSkipListReaderDefault) GetDoc ¶
func (m *MultiLevelSkipListReaderDefault) GetDoc() int
func (*MultiLevelSkipListReaderDefault) GetSkipDoc ¶
func (m *MultiLevelSkipListReaderDefault) GetSkipDoc(idx int) int
func (*MultiLevelSkipListReaderDefault) Init ¶
func (m *MultiLevelSkipListReaderDefault) Init(skipPointer int64, df int) error
func (*MultiLevelSkipListReaderDefault) MaxNumberOfSkipLevels ¶
func (m *MultiLevelSkipListReaderDefault) MaxNumberOfSkipLevels() int
type MultiLevelSkipListWriter ¶
type MultiLevelSkipListWriter interface { // WriteSkipData Subclasses must implement the actual skip data encoding in this method. // Params: level – the level skip data shall be writing for // skipBuffer – the skip buffer to write to WriteSkipData(level int, skipBuffer store.IndexOutput) error // Init Allocates internal skip buffers. Init() // ResetSkip Creates new buffers or empties the existing ones ResetSkip() // BufferSkip Writes the current skip data to the buffers. The current document frequency // determines the max level is skip data is to be written to. // Params: df – the current document frequency // Throws: IOException – If an I/O error occurs BufferSkip(df int) error // WriteSkip Writes the buffered skip lists to the given output. // Params: output – the IndexOutput the skip lists shall be written to // Returns: the pointer the skip list starts WriteSkip(output store.IndexOutput) (int64, error) // WriteLevelLength Writes the length of a level to the given output. // Params: levelLength – the length of a level // output – the IndexOutput the length shall be written to WriteLevelLength(levelLength int64, output store.IndexOutput) error // WriteChildPointer Writes the child pointer of a block to the given output. // Params: childPointer – block of higher level point to the lower level // skipBuffer – the skip buffer to write to WriteChildPointer(childPointer int64, skipBuffer store.DataOutput) error }
MultiLevelSkipListWriter This abstract class writes skip lists with multiple levels.
Example for skipInterval = 3: c (skip level 2) c c c (skip level 1) x x x x x x x x x x (skip level 0) d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d (posting list) 3 6 9 12 15 18 21 24 27 30 (df) d - document x - skip data c - skip data with child pointer Skip level i contains every skipInterval-th entry from skip level i-1. Therefore the number of entries on level i is: floor(df / ((skipInterval ^ (i + 1))). Each skip entry on a level i>0 contains a pointer to the corresponding skip entry in list i-1. This guarantees a logarithmic amount of skips to find the target document. While this class takes care of writing the different skip levels, subclasses must define the actual format of the skip data.
type MultiLevelSkipListWriterDefault ¶
type MultiLevelSkipListWriterDefault struct { // number of levels in this skip list NumberOfSkipLevels int // contains filtered or unexported fields }
func NewMultiLevelSkipListWriterDefault ¶
func NewMultiLevelSkipListWriterDefault(cfg *MultiLevelSkipListWriterDefaultConfig) *MultiLevelSkipListWriterDefault
type MultiLevelSkipListWriterDefaultConfig ¶
type MultiLevelSkipListWriterDefaultConfig struct { SkipInterval int SkipMultiplier int MaxSkipLevels int DF int WriteSkipData func(level int, skipBuffer store.IndexOutput) error WriteLevelLength func(levelLength int64, output store.IndexOutput) error WriteChildPointer func(childPointer int64, skipBuffer store.DataOutput) error }
type NoMergePolicy ¶
type NoMergePolicy struct {
*MergePolicyBase
}
func NewNoMergePolicy ¶
func NewNoMergePolicy() *NoMergePolicy
func (*NoMergePolicy) FindForcedDeletesMerges ¶
func (n *NoMergePolicy) FindForcedDeletesMerges(segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
func (*NoMergePolicy) FindForcedMerges ¶
func (n *NoMergePolicy) FindForcedMerges(segmentInfos *SegmentInfos, maxSegmentCount int, segmentsToMerge map[*SegmentCommitInfo]bool, mergeContext MergeContext) (*MergeSpecification, error)
func (*NoMergePolicy) FindFullFlushMerges ¶
func (n *NoMergePolicy) FindFullFlushMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
func (*NoMergePolicy) FindMerges ¶
func (n *NoMergePolicy) FindMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
func (*NoMergePolicy) GetNoCFSRatio ¶
func (n *NoMergePolicy) GetNoCFSRatio() float64
func (*NoMergePolicy) Size ¶
func (n *NoMergePolicy) Size(info *SegmentCommitInfo, mergeContext MergeContext) (int64, error)
func (*NoMergePolicy) UseCompoundFile ¶
func (n *NoMergePolicy) UseCompoundFile(infos *SegmentInfos, newSegment *SegmentCommitInfo, mergeContext MergeContext) (bool, error)
type NodeApply ¶
type NodeApply interface { Apply(bufferedDeletes *BufferedUpdates, docIDUpto int) error IsDelete() bool }
type NormValuesWriter ¶
type NormValuesWriter struct {
// contains filtered or unexported fields
}
NormValuesWriter Buffers up pending long per doc, then flushes when segment flushes.
func NewNormValuesWriter ¶
func NewNormValuesWriter(fieldInfo *document.FieldInfo) *NormValuesWriter
func (*NormValuesWriter) AddValue ¶
func (n *NormValuesWriter) AddValue(docID int, value int64) error
func (*NormValuesWriter) Finish ¶
func (n *NormValuesWriter) Finish(maxDoc int)
func (*NormValuesWriter) Flush ¶
func (n *NormValuesWriter) Flush(state *SegmentWriteState, sortMap *DocMap, normsConsumer NormsConsumer) error
type NormsConsumer ¶
type NormsConsumer interface { io.Closer // AddNormsField Writes normalization values for a field. //Params: field – field information // normsProducer – NormsProducer of the numeric norm values //Throws: IOException – if an I/O error occurred. AddNormsField(field *document.FieldInfo, normsProducer NormsProducer) error // Merge Merges in the fields from the readers in mergeState. // The default implementation calls mergeNormsField for each field, // filling segments with missing norms for the field with zeros. // Implementations can override this method for more sophisticated merging // (bulk-byte copying, etc). Merge(mergeState *MergeState) error // MergeNormsField Merges the norms from toMerge. // The default implementation calls FnAddNormsField, passing an Iterable // that merges and filters deleted documents on the fly. MergeNormsField(mergeFieldInfo *document.FieldInfo, mergeState *MergeState) error }
NormsConsumer Abstract API that consumes normalization values. Concrete implementations of this actually do "something" with the norms (write it into the index in a specific format). The lifecycle is: NormsConsumer is created by NormsFormat.normsConsumer(SegmentWriteState). FnAddNormsField is called for each field with normalization values. The API is a "pull" rather than "push", and the implementation is free to iterate over the values multiple times (Iterable.iterator()). After all fields are added, the consumer is closed.
type NormsConsumerDefault ¶
type NormsConsumerDefault struct {
FnAddNormsField func(field *document.FieldInfo, normsProducer NormsProducer) error
}
func (*NormsConsumerDefault) Merge ¶
func (n *NormsConsumerDefault) Merge(mergeState *MergeState) error
func (*NormsConsumerDefault) MergeNormsField ¶
func (n *NormsConsumerDefault) MergeNormsField(mergeFieldInfo *document.FieldInfo, mergeState *MergeState) error
type NormsFormat ¶
type NormsFormat interface { // NormsConsumer Returns a NormsConsumer to write norms to the index. NormsConsumer(state *SegmentWriteState) (NormsConsumer, error) // NormsProducer Returns a NormsProducer to read norms from the index. // NOTE: by the time this call returns, it must hold open any files it will need to use; else, // those files may be deleted. Additionally, required files may be deleted during the execution // of this call before there is a chance to open them. Under these circumstances an IOException // should be thrown by the implementation. IOExceptions are expected and will automatically // cause a retry of the segment opening logic with the newly revised segments. NormsProducer(state *SegmentReadState) (NormsProducer, error) }
NormsFormat Encodes/decodes per-document score normalization values.
type NormsProducer ¶
type NormsProducer interface { io.Closer // GetNorms Returns NumericDocValues for this field. The returned instance need not be thread-safe: // it will only be used by a single thread. GetNorms(field *document.FieldInfo) (NumericDocValues, error) // CheckIntegrity Checks consistency of this producer // Note that this may be costly in terms of I/O, e.g. may involve computing a checksum item // against large data files. CheckIntegrity() error // GetMergeInstance Returns an instance optimized for merging. This instance may only be used from the // thread that acquires it. // The default implementation returns this GetMergeInstance() NormsProducer }
NormsProducer Abstract API that produces field normalization values
type NumericDVs ¶
type NumericDVs struct {
// contains filtered or unexported fields
}
func NewNumericDVs ¶
func NewNumericDVs(values []int64, docsWithField *bitset.BitSet) *NumericDVs
type NumericDocValues ¶
type NumericDocValues interface { types.DocValuesIterator // LongValue Returns the numeric item for the current document ID. It is illegal to call this method // after advanceExact(int) returned false. // Returns: numeric item LongValue() (int64, error) }
NumericDocValues A per-document numeric item.
func AsNumericDocValues ¶
func AsNumericDocValues(iterator DocValuesFieldUpdatesIterator) NumericDocValues
func GetNumeric ¶
func GetNumeric(reader LeafReader, field string) (NumericDocValues, error)
type NumericDocValuesDefault ¶
type NumericDocValuesDefault struct { FnDocID func() int FnNextDoc func() (int, error) FnAdvance func(target int) (int, error) FnSlowAdvance func(target int) (int, error) FnCost func() int64 FnAdvanceExact func(target int) (bool, error) FnLongValue func() (int64, error) }
func (*NumericDocValuesDefault) Advance ¶
func (n *NumericDocValuesDefault) Advance(target int) (int, error)
func (*NumericDocValuesDefault) AdvanceExact ¶
func (n *NumericDocValuesDefault) AdvanceExact(target int) (bool, error)
func (*NumericDocValuesDefault) Cost ¶
func (n *NumericDocValuesDefault) Cost() int64
func (*NumericDocValuesDefault) DocID ¶
func (n *NumericDocValuesDefault) DocID() int
func (*NumericDocValuesDefault) LongValue ¶
func (n *NumericDocValuesDefault) LongValue() (int64, error)
func (*NumericDocValuesDefault) NextDoc ¶
func (n *NumericDocValuesDefault) NextDoc() (int, error)
func (*NumericDocValuesDefault) SlowAdvance ¶
func (n *NumericDocValuesDefault) SlowAdvance(target int) (int, error)
type NumericDocValuesProvider ¶
type NumericDocValuesProvider interface {
Get(reader LeafReader) (NumericDocValues, error)
}
NumericDocValuesProvider Provide a NumericDocValues instance for a LeafReader
type NumericDocValuesSub ¶
type NumericDocValuesSub struct {
// contains filtered or unexported fields
}
NumericDocValuesSub Tracks state of one numeric sub-reader that we are merging
type NumericDocValuesUpdate ¶
type NumericDocValuesUpdate struct { }
func NewNumericDocValuesUpdate ¶
func NewNumericDocValuesUpdate(term *Term, field string, value int64) *NumericDocValuesUpdate
func (*NumericDocValuesUpdate) GetDocValuesType ¶
func (n *NumericDocValuesUpdate) GetDocValuesType() document.DocValuesType
func (*NumericDocValuesUpdate) GetOptions ¶
func (n *NumericDocValuesUpdate) GetOptions() *DocValuesUpdateOptions
func (*NumericDocValuesUpdate) HasValue ¶
func (n *NumericDocValuesUpdate) HasValue() bool
func (*NumericDocValuesUpdate) ValueSizeInBytes ¶
func (n *NumericDocValuesUpdate) ValueSizeInBytes() int64
func (*NumericDocValuesUpdate) ValueToString ¶
func (n *NumericDocValuesUpdate) ValueToString() string
func (*NumericDocValuesUpdate) WriteTo ¶
func (n *NumericDocValuesUpdate) WriteTo(output store.DataOutput) error
type NumericDocValuesWriter ¶
type NumericDocValuesWriter struct {
// contains filtered or unexported fields
}
func NewNumericDocValuesWriter ¶
func NewNumericDocValuesWriter(fieldInfo *document.FieldInfo) *NumericDocValuesWriter
func (*NumericDocValuesWriter) AddValue ¶
func (n *NumericDocValuesWriter) AddValue(docID int, value int64) error
func (*NumericDocValuesWriter) Flush ¶
func (n *NumericDocValuesWriter) Flush(state *SegmentWriteState, sortMap DocMap, consumer DocValuesConsumer) error
func (*NumericDocValuesWriter) GetDocValues ¶
func (n *NumericDocValuesWriter) GetDocValues() types.DocIdSetIterator
type OneMerge ¶
type OneMerge struct {
// contains filtered or unexported fields
}
OneMerge provides the information necessary to perform an individual primitive merge operation, resulting in a single new segment. The merge spec includes the subset of segments to be merged as well as whether the new segment should use the compound file format. lucene.experimental
type OneMergeProgress ¶
type OneMergeProgress struct {
// contains filtered or unexported fields
}
OneMergeProgress Progress and state for an executing merge. This class encapsulates the logic to pause and resume the merge thread or to abort the merge entirely. lucene.experimental
type OrdTermState ¶
type OrdTermState struct {
Ord int64
}
func NewOrdTermState ¶
func NewOrdTermState() *OrdTermState
func (*OrdTermState) CopyFrom ¶
func (r *OrdTermState) CopyFrom(other TermState)
type OrdinalMap ¶
type OrdinalMap struct {
// contains filtered or unexported fields
}
OrdinalMap Maps per-segment ordinals to/from global ordinal space, using a compact packed-ints representation. NOTE: this is a costly operation, as it must merge sort all terms, and may require non-trivial RAM once done. It's better to operate in segment-private ordinal space instead when possible. lucene.internal
func NewOrdinalMap ¶
func NewOrdinalMap(subs []TermsEnum, segmentMap *SegmentMap, acceptableOverheadRatio float64) (*OrdinalMap, error)
type PagedBytes ¶
type PagedBytes struct {
// contains filtered or unexported fields
}
PagedBytes Represents a logical byte[] as a series of pages. You can write-once into the logical byte[] (append only), using copy, and then retrieve slices (BytesRef) into it using fill. lucene.internal TODO: refactor this, byteblockpool, fst.bytestore, and any other "shift/mask big arrays". there are too many of these classes!
func NewPagedBytes ¶
func NewPagedBytes(blockBits int) *PagedBytes
func (*PagedBytes) CloneWithoutBlocks ¶
func (r *PagedBytes) CloneWithoutBlocks() *PagedBytes
func (*PagedBytes) CopyV1 ¶
func (r *PagedBytes) CopyV1(in store.IndexInput, byteCount int) error
CopyV1 Read this many bytes from in
func (*PagedBytes) CopyV2 ¶
func (r *PagedBytes) CopyV2(bytes []byte, out *bytes.Buffer) error
CopyV2 Copy BytesRef in, setting BytesRef out to the result. Do not use this if you will use freeze(true). This only supports bytes.length <= blockSize
func (*PagedBytes) Freeze ¶
func (r *PagedBytes) Freeze(trim bool) (*PagedBytesReader, error)
Freeze Commits final byte[], trimming it if necessary and if trim=true
func (*PagedBytes) GetDataInput ¶
func (r *PagedBytes) GetDataInput() *PagedBytesDataInput
func (*PagedBytes) GetDataOutput ¶
func (r *PagedBytes) GetDataOutput() *PagedBytesDataOutput
func (*PagedBytes) GetPointer ¶
func (r *PagedBytes) GetPointer() int64
type PagedBytesDataInput ¶
type PagedBytesDataInput struct { *store.BaseDataInput *PagedBytes // contains filtered or unexported fields }
func NewPagedBytesDataInput ¶
func NewPagedBytesDataInput(pageBytes *PagedBytes) *PagedBytesDataInput
func (*PagedBytesDataInput) Clone ¶
func (r *PagedBytesDataInput) Clone() store.CloneReader
func (*PagedBytesDataInput) ReadByte ¶
func (r *PagedBytesDataInput) ReadByte() (byte, error)
type PagedBytesDataOutput ¶
type PagedBytesDataOutput struct { *store.BaseDataOutput *PagedBytes }
func (*PagedBytesDataOutput) GetPosition ¶
func (r *PagedBytesDataOutput) GetPosition() int64
GetPosition Return the current byte position.
func (*PagedBytesDataOutput) Write ¶
func (r *PagedBytesDataOutput) Write(bs []byte) (n int, err error)
func (*PagedBytesDataOutput) WriteByte ¶
func (r *PagedBytesDataOutput) WriteByte(b byte) error
type PagedBytesReader ¶
type PagedBytesReader struct {
// contains filtered or unexported fields
}
PagedBytesReader Provides methods to read BytesRefs from a frozen PagedBytes.
func NewPagedBytesReader ¶
func NewPagedBytesReader(pagedBytes *PagedBytes) *PagedBytesReader
func (*PagedBytesReader) FillSlice ¶
func (p *PagedBytesReader) FillSlice(b *bytes.Buffer, start, length int)
FillSlice Gets a slice out of PagedBytes starting at start with a given length. Iff the slice spans across a block border this method will allocate sufficient resources and copy the paged data. Slices spanning more than two blocks are not supported. lucene.internal
func (*PagedBytesReader) GetByte ¶
func (p *PagedBytesReader) GetByte(o int64) byte
type ParallelPostingsArray ¶
type ParallelPostingsArray interface { NewInstance() ParallelPostingsArray BytesPerPosting() int GetTextStarts(index int) int GetAddressOffset(index int) int GetByteStarts(index int) int SetTextStarts(termID, v int) SetAddressOffset(termID, v int) SetByteStarts(termID, v int) TextStarts() []uint32 Grow() }
type ParallelPostingsArrayDefault ¶
type ParallelPostingsArrayDefault struct {
// contains filtered or unexported fields
}
func NewParallelPostingsArrayDefault ¶
func NewParallelPostingsArrayDefault() *ParallelPostingsArrayDefault
func (*ParallelPostingsArrayDefault) AddressOffset ¶
func (p *ParallelPostingsArrayDefault) AddressOffset() []int
func (*ParallelPostingsArrayDefault) ByteStarts ¶
func (p *ParallelPostingsArrayDefault) ByteStarts() []int
func (*ParallelPostingsArrayDefault) GetAddressOffset ¶
func (p *ParallelPostingsArrayDefault) GetAddressOffset(index int) int
func (*ParallelPostingsArrayDefault) GetByteStarts ¶
func (p *ParallelPostingsArrayDefault) GetByteStarts(index int) int
func (*ParallelPostingsArrayDefault) GetTextStarts ¶
func (p *ParallelPostingsArrayDefault) GetTextStarts(index int) int
func (*ParallelPostingsArrayDefault) Grow ¶
func (p *ParallelPostingsArrayDefault) Grow()
func (*ParallelPostingsArrayDefault) SetAddressOffset ¶
func (p *ParallelPostingsArrayDefault) SetAddressOffset(termID, v int)
func (*ParallelPostingsArrayDefault) SetByteStarts ¶
func (p *ParallelPostingsArrayDefault) SetByteStarts(termID, v int)
func (*ParallelPostingsArrayDefault) SetTextStarts ¶
func (p *ParallelPostingsArrayDefault) SetTextStarts(termID, v int)
func (*ParallelPostingsArrayDefault) TextStarts ¶
func (p *ParallelPostingsArrayDefault) TextStarts() []uint32
type PendingDeletes ¶
type PendingDeletes interface { GetMutableBits() *bitset.BitSet // Delete // Marks a document as deleted in this segment and return true if a document got actually deleted or // if the document was already deleted. Delete(docID int) (bool, error) // GetLiveDocs Returns a snapshot of the current live docs. GetLiveDocs() util.Bits // GetHardLiveDocs Returns a snapshot of the hard live docs. GetHardLiveDocs() util.Bits // NumPendingDeletes // Returns the number of pending deletes that are not written to disk. NumPendingDeletes() int // OnNewReader // Called once a new reader is opened for this segment ie. when deletes or updates are applied. OnNewReader(reader CodecReader, info *SegmentCommitInfo) error // DropChanges Resets the pending docs DropChanges() // WriteLiveDocs Writes the live docs to disk and returns true if any new docs were written. WriteLiveDocs(dir store.Directory) (bool, error) // IsFullyDeleted // Returns true iff the segment represented by this PendingDeletes is fully deleted IsFullyDeleted(readerIOSupplier func() CodecReader) (bool, error) // OnDocValuesUpdate Called for every field update for the given field at flush time // Params: info – the field info of the field that's updated // iterator – the values to apply OnDocValuesUpdate(info *document.FieldInfo, iterator DocValuesFieldUpdatesIterator) GetDelCount() int }
type PendingDeletesDefault ¶
type PendingDeletesDefault struct {
// contains filtered or unexported fields
}
PendingDeletesDefault This class handles accounting and applying pending deletes for live segment readers
func NewPendingDeletes ¶
func NewPendingDeletes(reader *SegmentReader, info *SegmentCommitInfo) *PendingDeletesDefault
func NewPendingDeletesV1 ¶
func NewPendingDeletesV1(info *SegmentCommitInfo) *PendingDeletesDefault
func NewPendingDeletesV2 ¶
func NewPendingDeletesV2(info *SegmentCommitInfo, liveDocs util.Bits, liveDocsInitialized bool) *PendingDeletesDefault
func (*PendingDeletesDefault) Delete ¶
func (p *PendingDeletesDefault) Delete(docID int) (bool, error)
func (*PendingDeletesDefault) DropChanges ¶
func (p *PendingDeletesDefault) DropChanges()
func (*PendingDeletesDefault) GetDelCount ¶
func (p *PendingDeletesDefault) GetDelCount() int
func (*PendingDeletesDefault) GetHardLiveDocs ¶
func (p *PendingDeletesDefault) GetHardLiveDocs() util.Bits
func (*PendingDeletesDefault) GetLiveDocs ¶
func (p *PendingDeletesDefault) GetLiveDocs() util.Bits
func (*PendingDeletesDefault) GetMutableBits ¶
func (p *PendingDeletesDefault) GetMutableBits() *bitset.BitSet
func (*PendingDeletesDefault) IsFullyDeleted ¶
func (p *PendingDeletesDefault) IsFullyDeleted(readerIOSupplier func() CodecReader) (bool, error)
func (*PendingDeletesDefault) NumPendingDeletes ¶
func (p *PendingDeletesDefault) NumPendingDeletes() int
func (*PendingDeletesDefault) OnDocValuesUpdate ¶
func (p *PendingDeletesDefault) OnDocValuesUpdate(info *document.FieldInfo, iterator DocValuesFieldUpdatesIterator)
func (*PendingDeletesDefault) OnNewReader ¶
func (p *PendingDeletesDefault) OnNewReader(reader CodecReader, info *SegmentCommitInfo) error
func (*PendingDeletesDefault) WriteLiveDocs ¶
func (p *PendingDeletesDefault) WriteLiveDocs(dir store.Directory) (bool, error)
type PendingSoftDeletes ¶
type PendingSoftDeletes struct { *PendingDeletesDefault // contains filtered or unexported fields }
func NewPendingSoftDeletes ¶
func NewPendingSoftDeletes(field string, info *SegmentCommitInfo) *PendingSoftDeletes
func NewPendingSoftDeletesV1 ¶
func NewPendingSoftDeletesV1(field string, reader *SegmentReader, info *SegmentCommitInfo) *PendingSoftDeletes
func (*PendingSoftDeletes) DropChanges ¶
func (p *PendingSoftDeletes) DropChanges()
func (*PendingSoftDeletes) GetDelCount ¶
func (p *PendingSoftDeletes) GetDelCount() int
func (*PendingSoftDeletes) GetHardLiveDocs ¶
func (p *PendingSoftDeletes) GetHardLiveDocs() util.Bits
func (*PendingSoftDeletes) GetLiveDocs ¶
func (p *PendingSoftDeletes) GetLiveDocs() util.Bits
func (*PendingSoftDeletes) GetMutableBits ¶
func (p *PendingSoftDeletes) GetMutableBits() *bitset.BitSet
func (*PendingSoftDeletes) IsFullyDeleted ¶
func (p *PendingSoftDeletes) IsFullyDeleted(readerIOSupplier func() CodecReader) (bool, error)
func (*PendingSoftDeletes) NumPendingDeletes ¶
func (p *PendingSoftDeletes) NumPendingDeletes() int
func (*PendingSoftDeletes) OnDocValuesUpdate ¶
func (p *PendingSoftDeletes) OnDocValuesUpdate(info *document.FieldInfo, iterator DocValuesFieldUpdatesIterator)
func (*PendingSoftDeletes) OnNewReader ¶
func (p *PendingSoftDeletes) OnNewReader(reader CodecReader, info *SegmentCommitInfo) error
func (*PendingSoftDeletes) WriteLiveDocs ¶
func (p *PendingSoftDeletes) WriteLiveDocs(dir store.Directory) (bool, error)
type PerField ¶
type PerField struct {
// contains filtered or unexported fields
}
PerField NOTE: not static: accesses at least docState, termsHash.
type PointValuesWriter ¶
type PointValuesWriter struct {
// contains filtered or unexported fields
}
PointValuesWriter Buffers up pending byte[][] item(s) per doc, then flushes when segment flushes.
func NewPointValuesWriter ¶
func NewPointValuesWriter(fieldInfo *document.FieldInfo) *PointValuesWriter
func (*PointValuesWriter) AddPackedValue ¶
func (p *PointValuesWriter) AddPackedValue(docID int, value []byte) error
AddPackedValue TODO: if exactly the same item is added to exactly the same doc, should we dedup?
func (*PointValuesWriter) Flush ¶
func (p *PointValuesWriter) Flush(state *SegmentWriteState, docMap *DocMap, writer PointsWriter) error
type PointsFormat ¶
type PointsFormat interface { // FieldsWriter Writes a new segment FieldsWriter(state *SegmentWriteState) (PointsWriter, error) // FieldsReader Reads a segment. NOTE: by the time this call returns, it must hold open any files // it will need to use; else, those files may be deleted. Additionally, required files may be // deleted during the execution of this call before there is a chance to open them. Under these // circumstances an IOException should be thrown by the implementation. IOExceptions are expected // and will automatically cause a retry of the segment opening logic with the newly revised segments. FieldsReader(state *SegmentReadState) (PointsReader, error) }
PointsFormat Encodes/decodes indexed points. lucene.experimental
type PointsReader ¶
type PointsReader interface { io.Closer // CheckIntegrity Checks consistency of this reader. // Note that this may be costly in terms of I/O, // e.g. may involve computing a checksum item against large data files. // lucene.internal CheckIntegrity() error // GetValues Return PointValues for the given field. GetValues(field string) (types.PointValues, error) // GetMergeInstance // Returns an instance optimized for merging. // This instance may only be used in the thread that acquires it. // The default implementation returns this GetMergeInstance() PointsReader }
PointsReader Abstract API to visit point values. lucene.experimental
type PointsWriter ¶
type PointsWriter interface { io.Closer // WriteField Write all values contained in the provided reader WriteField(ctx context.Context, fieldInfo *document.FieldInfo, values PointsReader) error // Finish Called once at the end before close Finish() error }
PointsWriter Abstract API to write points lucene.experimental
type PositionData ¶
func NewPositionData ¶
func NewPositionData(pos int, payload []byte) *PositionData
type PostingsBytesStartArray ¶
type PostingsBytesStartArray struct {
// contains filtered or unexported fields
}
func NewPostingsBytesStartArray ¶
func NewPostingsBytesStartArray(perField TermsHashPerField) *PostingsBytesStartArray
func (*PostingsBytesStartArray) Clear ¶
func (p *PostingsBytesStartArray) Clear() []uint32
func (*PostingsBytesStartArray) Grow ¶
func (p *PostingsBytesStartArray) Grow() []uint32
func (*PostingsBytesStartArray) Init ¶
func (p *PostingsBytesStartArray) Init() []uint32
type PostingsEnum ¶
type PostingsEnum interface { types.DocIdSetIterator // Freq Returns term frequency in the current document, or 1 if the field was indexed with IndexOptions.DOCS. Do not call this before nextDoc is first called, nor after nextDoc returns DocIdSetIterator.NO_MORE_DOCS. // NOTE: if the PostingsEnum was obtain with NONE, the result of this method is undefined. Freq() (int, error) // NextPosition Returns the next position, or -1 if positions were not indexed. Calling this more than freq() times is undefined. NextPosition() (int, error) // StartOffset Returns start offset for the current position, or -1 if offsets were not indexed. StartOffset() (int, error) // EndOffset Returns end offset for the current position, or -1 if offsets were not indexed. EndOffset() (int, error) // GetPayload Returns the payload at this position, or null if no payload was indexed. You should not // modify anything (neither members of the returned BytesRef nor bytes in the byte[]). GetPayload() ([]byte, error) }
PostingsEnum Iterates through the postings. NOTE: you must first call nextDoc before using any of the per-doc methods.
type PostingsFormat ¶
type PostingsFormat interface { NamedSPI // FieldsConsumer Writes a new segment FieldsConsumer(state *SegmentWriteState) (FieldsConsumer, error) // FieldsProducer Reads a segment. NOTE: by the time this call returns, it must hold open any files it // will need to use; else, those files may be deleted. Additionally, required files may // be deleted during the execution of this call before there is a chance to open them. // Under these circumstances an IOException should be thrown by the implementation. // IOExceptions are expected and will automatically cause a retry of the segment opening // logic with the newly revised segments. FieldsProducer(state *SegmentReadState) (FieldsProducer, error) }
PostingsFormat Encodes/decodes terms, postings, and proximity data. Note, when extending this class, the name (getName) may written into the index in certain configurations. In order for the segment to be read, the name must resolve to your implementation via forName(String). This method uses Java's Service SortFieldProvider Interface (SPI) to resolve format names.
If you implement your own format, make sure that it has a no-arg constructor so SPI can load it. ServiceLoader lucene.experimental
type PrefixCodedTerms ¶
type PrefixCodedTerms struct {
// contains filtered or unexported fields
}
PrefixCodedTerms Prefix codes term instances (prefixes are shared). This is expected to be faster to build than a FST and might also be more compact if there are no common suffixes. lucene.internal
type Reader ¶
type Reader interface { io.Closer // GetTermVectors Retrieve term vectors for this document, or null if term vectors were not indexed. // The returned Fields instance acts like a single-document inverted index (the docID will be 0). GetTermVectors(docID int) (Fields, error) // GetTermVector Retrieve term vector for this document and field, or null if term vectors were not indexed. // The returned Fields instance acts like a single-document inverted index (the docID will be 0). GetTermVector(docID int, field string) (Terms, error) // NumDocs Returns the number of documents in this index. // NOTE: This operation may run in O(maxDoc). Implementations that can't return this number in // constant-time should cache it. NumDocs() int // MaxDoc Returns one greater than the largest possible document number. This may be used to, // e.g., determine how big to allocate an array which will have an element for every document // number in an index. MaxDoc() int // NumDeletedDocs Returns the number of deleted documents. // NOTE: This operation may run in O(maxDoc). NumDeletedDocs() int // Document Returns the stored fields of the nth Document in this index. This is just sugar for using // DocumentStoredFieldVisitor. // NOTE: for performance reasons, this method does not check if the requested document is deleted, and // therefore asking for a deleted document may yield unspecified results. Usually this is not required, // however you can test if the doc is deleted by checking the Bits returned from MultiBits.getLiveDocs. // NOTE: only the content of a field is returned, if that field was stored during indexing. Metadata like // boost, omitNorm, IndexOptions, tokenized, etc., are not preserved. // Throws: CorruptIndexException – if the index is corrupt // IOException – if there is a low-level IO error // TODO: we need a separate StoredField, so that the // Document returned here contains that class not // IndexableField Document(docID int) (*document.Document, error) // DocumentV1 Expert: visits the fields of a stored document, for custom processing/loading of each field. // If you simply want to load all fields, use document(int). If you want to load a subset, // use DocumentStoredFieldVisitor. DocumentV1(docID int, visitor document.StoredFieldVisitor) error // DocumentV2 Like document(int) but only loads the specified fields. Note that this is simply sugar for // DocumentStoredFieldVisitor.DocumentStoredFieldVisitor(Set). DocumentV2(docID int, fieldsToLoad map[string]struct{}) (*document.Document, error) // HasDeletions Returns true if any documents have been deleted. Implementers should consider overriding // this method if maxDoc() or numDocs() are not constant-time operations. HasDeletions() bool // DoClose Implements close. DoClose() error // GetContext Expert: Returns the root ReaderContext for this Reader's sub-reader tree. // If this reader is composed of sub readers, i.e. this reader being a composite reader, this method // returns a CompositeReaderContext holding the reader's direct children as well as a view of the // reader tree's atomic leaf contexts. All sub- ReaderContext instances referenced from this // readers top-level context are private to this reader and are not shared with another context tree. // For example, IndexSearcher uses this API to drive searching by one atomic leaf reader at a time. // If this reader is not composed of child readers, this method returns an LeafReaderContext. // Note: Any of the sub-CompositeReaderContext instances referenced from this top-level context do // not support CompositeReaderContext.leaves(). Only the top-level context maintains the convenience // leaf-view for performance reasons. GetContext() (ctx ReaderContext, err error) // Leaves Returns the reader's leaves, or itself if this reader is atomic. This is a convenience method // calling this.getContext().leaves(). // See Also: ReaderContext.leaves() Leaves() ([]*LeafReaderContext, error) // GetReaderCacheHelper Optional method: Return a Reader.CacheHelper that can be used to cache based // on the content of this reader. Two readers that have different data or different sets of deleted // documents will be considered different. // A return item of null indicates that this reader is not suited for caching, which is typically the // case for short-lived wrappers that alter the content of the wrapped reader. GetReaderCacheHelper() CacheHelper // DocFreq Returns the number of documents containing the term. This method returns 0 if the term or field // does not exists. This method does not take into account deleted documents that have not yet been merged away. // See Also: TermsEnum.docFreq() DocFreq(ctx context.Context, term Term) (int, error) // TotalTermFreq Returns the total number of occurrences of term across all documents (the sum of the freq() for each doc that has this term). Note that, like other term measures, this measure does not take deleted documents into account. TotalTermFreq(ctx context.Context, term *Term) (int64, error) // GetSumDocFreq Returns the sum of TermsEnum.docFreq() for all terms in this field. Note that, just like // other term measures, this measure does not take deleted documents into account. // See Also: Terms.getSumDocFreq() GetSumDocFreq(field string) (int64, error) // GetDocCount Returns the number of documents that have at least one term for this field. Note that, // just like other term measures, this measure does not take deleted documents into account. // See Also: Terms.getDocCount() GetDocCount(field string) (int, error) // GetSumTotalTermFreq Returns the sum of TermsEnum.totalTermFreq for all terms in this field. Note that, // just like other term measures, this measure does not take deleted documents into account. // See Also: Terms.getSumTotalTermFreq() GetSumTotalTermFreq(field string) (int64, error) GetRefCount() int IncRef() error DecRef() error GetMetaData() *LeafMetaData }
type ReaderBase ¶
func NewIndexReaderBase ¶
func NewIndexReaderBase(spi ReaderSPI) *ReaderBase
func (*ReaderBase) Close ¶
func (r *ReaderBase) Close() error
func (*ReaderBase) DecRef ¶
func (r *ReaderBase) DecRef() error
func (*ReaderBase) DocumentV2 ¶
func (*ReaderBase) GetRefCount ¶
func (r *ReaderBase) GetRefCount() int
func (*ReaderBase) GetTermVector ¶
func (r *ReaderBase) GetTermVector(docID int, field string) (Terms, error)
func (*ReaderBase) HasDeletions ¶
func (r *ReaderBase) HasDeletions() bool
func (*ReaderBase) IncRef ¶
func (r *ReaderBase) IncRef() error
func (*ReaderBase) Leaves ¶
func (r *ReaderBase) Leaves() ([]*LeafReaderContext, error)
func (*ReaderBase) NotifyReaderClosedListeners ¶
func (r *ReaderBase) NotifyReaderClosedListeners() error
NotifyReaderClosedListeners overridden by StandardDirectoryReader and SegmentReader
func (*ReaderBase) NumDeletedDocs ¶
func (r *ReaderBase) NumDeletedDocs() int
func (*ReaderBase) RegisterParentReader ¶
func (r *ReaderBase) RegisterParentReader(reader Reader)
RegisterParentReader Expert: This method is called by IndexReaders which wrap other readers (e.g. CompositeReader or FilterLeafReader) to register the parent at the child (this reader) on construction of the parent. When this reader is closed, it will mark all registered parents as closed, too. The references to parent readers are weak only, so they can be GCed once they are no longer in use.
func (*ReaderBase) TryIncRef ¶
func (r *ReaderBase) TryIncRef() bool
type ReaderCommit ¶
type ReaderCommit struct {
// contains filtered or unexported fields
}
func NewReaderCommit ¶
func NewReaderCommit(reader *StandardDirectoryReader, infos *SegmentInfos, dir store.Directory) (*ReaderCommit, error)
func (*ReaderCommit) CompareTo ¶
func (r *ReaderCommit) CompareTo(commit IndexCommit) int
func (*ReaderCommit) Delete ¶
func (r *ReaderCommit) Delete() error
func (*ReaderCommit) GetDirectory ¶
func (r *ReaderCommit) GetDirectory() store.Directory
func (*ReaderCommit) GetFileNames ¶
func (r *ReaderCommit) GetFileNames() (map[string]struct{}, error)
func (*ReaderCommit) GetGeneration ¶
func (r *ReaderCommit) GetGeneration() int64
func (*ReaderCommit) GetReader ¶
func (r *ReaderCommit) GetReader() *StandardDirectoryReader
func (*ReaderCommit) GetSegmentCount ¶
func (r *ReaderCommit) GetSegmentCount() int
func (*ReaderCommit) GetSegmentsFileName ¶
func (r *ReaderCommit) GetSegmentsFileName() string
func (*ReaderCommit) GetUserData ¶
func (r *ReaderCommit) GetUserData() (map[string]string, error)
func (*ReaderCommit) IsDeleted ¶
func (r *ReaderCommit) IsDeleted() bool
type ReaderContext ¶
type ReaderContext interface { // Reader Returns the Reader, this context represents. Reader() Reader // Leaves Returns the context's leaves if this context is a top-level context. For convenience, if this is // an LeafReaderContext this returns itself as the only leaf. // Note: this is convenience method since leaves can always be obtained by walking the context tree // using children(). // Throws: ErrUnsupportedOperation – if this is not a top-level context. // See Also: children() Leaves() ([]*LeafReaderContext, error) // Children Returns the context's children iff this context is a composite context otherwise null. Children() []ReaderContext Identity() string }
ReaderContext A struct like class that represents a hierarchical relationship between Reader instances.
type ReaderPool ¶
type ReaderPool struct {
// contains filtered or unexported fields
}
ReaderPool Holds shared SegmentReader instances. IndexWriter uses SegmentReaders for 1) applying deletes/DV updates, 2) doing merges, 3) handing out a real-time reader. This pool reuses instances of the SegmentReaders in all these places if it is in "near real-time mode" (getReader() has been called on this instance).
func NewReaderPool ¶
func NewReaderPool(directory, originalDirectory store.Directory, segmentInfos *SegmentInfos, fieldNumbers *FieldNumbers, completedDelGenSupplier func() int64, softDeletesField string, reader *StandardDirectoryReader) (*ReaderPool, error)
func (*ReaderPool) Get ¶
func (p *ReaderPool) Get(info *SegmentCommitInfo, create bool) (*ReadersAndUpdates, error)
Get Obtain a ReadersAndLiveDocs instance from the readerPool. If create is true, you must later call release(ReadersAndUpdates, boolean).
type ReaderSorter ¶
type ReaderSorter struct { Readers []Reader FnCompare func(a, b LeafReader) int }
func (*ReaderSorter) Len ¶
func (r *ReaderSorter) Len() int
func (*ReaderSorter) Less ¶
func (r *ReaderSorter) Less(i, j int) bool
func (*ReaderSorter) Swap ¶
func (r *ReaderSorter) Swap(i, j int)
type ReaderWarmer ¶
type ReaderWarmer interface {
Warm(reader LeafReader) error
}
ReaderWarmer If DirectoryReader.open(IndexWriter) has been called (ie, this writer is in near real-time mode), then after a merge completes, this class can be invoked to warm the reader on the newly merged segment, before the merge commits. This is not required for near real-time search, but will reduce search latency on opening a new near real-time reader after a merge completes. lucene.experimental
NOTE: warm(LeafReader) is called before any deletes have been carried over to the merged segment.
type ReadersAndUpdates ¶
type ReadersAndUpdates struct {
// contains filtered or unexported fields
}
ReadersAndUpdates Used by IndexWriter to hold open SegmentReaders (for searching or merging), plus pending deletes and updates, for a given segment
func NewReadersAndUpdates ¶
func NewReadersAndUpdates(indexCreatedVersionMajor int, info *SegmentCommitInfo, pendingDeletes PendingDeletes) *ReadersAndUpdates
func NewReadersAndUpdatesV1 ¶
func NewReadersAndUpdatesV1(indexCreatedVersionMajor int, reader *SegmentReader, pendingDeletes PendingDeletes) (*ReadersAndUpdates, error)
func (*ReadersAndUpdates) AddDVUpdate ¶
func (r *ReadersAndUpdates) AddDVUpdate(update DocValuesFieldUpdates) error
AddDVUpdate Adds a new resolved (meaning it maps docIDs to new values) doc values packet. We buffer these in RAM and write to disk when too much RAM is used or when a merge needs to kick off, or a commit/refresh.
func (*ReadersAndUpdates) DecRef ¶
func (r *ReadersAndUpdates) DecRef()
func (*ReadersAndUpdates) GetDelCount ¶
func (r *ReadersAndUpdates) GetDelCount() int
func (*ReadersAndUpdates) GetNumDVUpdates ¶
func (r *ReadersAndUpdates) GetNumDVUpdates() int
func (*ReadersAndUpdates) GetReader ¶
func (r *ReadersAndUpdates) GetReader(context *store.IOContext) (*SegmentReader, error)
func (*ReadersAndUpdates) IncRef ¶
func (r *ReadersAndUpdates) IncRef()
func (*ReadersAndUpdates) RefCount ¶
func (r *ReadersAndUpdates) RefCount() int64
type RefCount ¶
type RefCount struct {
// contains filtered or unexported fields
}
func NewRefCount ¶
type Scorable ¶
type Scorable interface { // Score Returns the score of the current document matching the query. Score() (float64, error) // SmoothingScore Returns the smoothing score of the current document matching the query. This score is used when the query/term does not appear in the document, and behaves like an idf. The smoothing score is particularly important when the Scorer returns a product of probabilities so that the document score does not go to zero when one probability is zero. This can return 0 or a smoothing score. // Smoothing scores are described in many papers, including: Metzler, D. and Croft, W. B. , "Combining the Language Model and Inference Network Approaches to Retrieval," Information Processing and Management Special Issue on Bayesian Networks and Information Retrieval, 40(5), pp.735-750. SmoothingScore(docId int) (float64, error) }
Scorable Allows access to the score of a Query
type SegmentCommitInfo ¶
type SegmentCommitInfo struct {
// contains filtered or unexported fields
}
SegmentCommitInfo Embeds a [read-only] SegmentInfo and adds per-commit fields. lucene.experimental
func NewSegmentCommitInfo ¶
func NewSegmentCommitInfo(info *SegmentInfo, delCount, softDelCount int, delGen, fieldInfosGen, docValuesGen int64, id []byte) *SegmentCommitInfo
func (*SegmentCommitInfo) Clone ¶
func (s *SegmentCommitInfo) Clone() *SegmentCommitInfo
func (*SegmentCommitInfo) Files ¶
func (s *SegmentCommitInfo) Files() (map[string]struct{}, error)
func (*SegmentCommitInfo) GetDelCount ¶
func (s *SegmentCommitInfo) GetDelCount() int
GetDelCount Returns the number of deleted docs in the segment.
func (*SegmentCommitInfo) GetDelCountV1 ¶
func (s *SegmentCommitInfo) GetDelCountV1(includeSoftDeletes bool) int
func (*SegmentCommitInfo) GetDelGen ¶
func (s *SegmentCommitInfo) GetDelGen() int64
GetDelGen Returns generation number of the live docs file or -1 if there are no deletes yet.
func (*SegmentCommitInfo) GetDocValuesGen ¶
func (s *SegmentCommitInfo) GetDocValuesGen() int64
GetDocValuesGen Returns the generation number of the DocValues file or -1 if there are no doc-values updates yet.
func (*SegmentCommitInfo) GetFieldInfosGen ¶
func (s *SegmentCommitInfo) GetFieldInfosGen() int64
GetFieldInfosGen Returns the generation number of the field infos file or -1 if there are no field updates yet.
func (*SegmentCommitInfo) GetId ¶
func (s *SegmentCommitInfo) GetId() []byte
func (*SegmentCommitInfo) GetNextDelGen ¶
func (s *SegmentCommitInfo) GetNextDelGen() int64
GetNextDelGen Returns the next available generation number of the live docs file.
func (*SegmentCommitInfo) GetNextDocValuesGen ¶
func (s *SegmentCommitInfo) GetNextDocValuesGen() int64
GetNextDocValuesGen Returns the next available generation number of the DocValues files.
func (*SegmentCommitInfo) GetNextFieldInfosGen ¶
func (s *SegmentCommitInfo) GetNextFieldInfosGen() int64
GetNextFieldInfosGen Returns the next available generation number of the FieldInfos files.
func (*SegmentCommitInfo) GetNextWriteDelGen ¶
func (s *SegmentCommitInfo) GetNextWriteDelGen() int64
func (*SegmentCommitInfo) GetNextWriteDocValuesGen ¶
func (s *SegmentCommitInfo) GetNextWriteDocValuesGen() int64
func (*SegmentCommitInfo) GetNextWriteFieldInfosGen ¶
func (s *SegmentCommitInfo) GetNextWriteFieldInfosGen() int64
func (*SegmentCommitInfo) GetSoftDelCount ¶
func (s *SegmentCommitInfo) GetSoftDelCount() int
GetSoftDelCount Returns the number of only soft-deleted docs.
func (*SegmentCommitInfo) HasDeletions ¶
func (s *SegmentCommitInfo) HasDeletions() bool
HasDeletions Returns true if there are any deletions for the segment at this commit.
func (*SegmentCommitInfo) HasFieldUpdates ¶
func (s *SegmentCommitInfo) HasFieldUpdates() bool
HasFieldUpdates Returns true if there are any field updates for the segment in this commit.
func (*SegmentCommitInfo) Info ¶
func (s *SegmentCommitInfo) Info() *SegmentInfo
func (*SegmentCommitInfo) SetDelCount ¶
func (s *SegmentCommitInfo) SetDelCount(delCount int)
func (*SegmentCommitInfo) SetDocValuesUpdatesFiles ¶
func (s *SegmentCommitInfo) SetDocValuesUpdatesFiles(files map[int]map[string]struct{})
func (*SegmentCommitInfo) SetFieldInfosFiles ¶
func (s *SegmentCommitInfo) SetFieldInfosFiles(fieldInfosFiles map[string]struct{})
func (*SegmentCommitInfo) SetNextWriteDelGen ¶
func (s *SegmentCommitInfo) SetNextWriteDelGen(v int64)
func (*SegmentCommitInfo) SetNextWriteDocValuesGen ¶
func (s *SegmentCommitInfo) SetNextWriteDocValuesGen(v int64)
func (*SegmentCommitInfo) SetNextWriteFieldInfosGen ¶
func (s *SegmentCommitInfo) SetNextWriteFieldInfosGen(v int64)
func (*SegmentCommitInfo) SetSoftDelCount ¶
func (s *SegmentCommitInfo) SetSoftDelCount(softDelCount int)
func (*SegmentCommitInfo) SizeInBytes ¶
func (s *SegmentCommitInfo) SizeInBytes() (int64, error)
type SegmentCoreReaders ¶
type SegmentCoreReaders struct {
// contains filtered or unexported fields
}
SegmentCoreReaders Holds core readers that are shared (unchanged) when SegmentReader is cloned or reopened
func NewSegmentCoreReaders ¶
func NewSegmentCoreReaders(dir store.Directory, si *SegmentCommitInfo, context *store.IOContext) (*SegmentCoreReaders, error)
func (*SegmentCoreReaders) DecRef ¶
func (r *SegmentCoreReaders) DecRef() error
type SegmentDocValues ¶
type SegmentDocValues struct {
// contains filtered or unexported fields
}
SegmentDocValues Manages the DocValuesProducer held by SegmentReader and keeps track of their reference counting.
func NewSegmentDocValues ¶
func NewSegmentDocValues() *SegmentDocValues
func (*SegmentDocValues) GetDocValuesProducer ¶
func (s *SegmentDocValues) GetDocValuesProducer(gen int64, si *SegmentCommitInfo, dir store.Directory, infos *FieldInfos) (DocValuesProducer, error)
type SegmentDocValuesProducer ¶
type SegmentDocValuesProducer struct {
// contains filtered or unexported fields
}
func NewSegmentDocValuesProducer ¶
func NewSegmentDocValuesProducer(si *SegmentCommitInfo, dir store.Directory, coreInfos, allInfos *FieldInfos, segDocValues *SegmentDocValues) (*SegmentDocValuesProducer, error)
func (*SegmentDocValuesProducer) CheckIntegrity ¶
func (s *SegmentDocValuesProducer) CheckIntegrity() error
func (*SegmentDocValuesProducer) Close ¶
func (s *SegmentDocValuesProducer) Close() error
func (*SegmentDocValuesProducer) GetBinary ¶
func (s *SegmentDocValuesProducer) GetBinary(field *document.FieldInfo) (BinaryDocValues, error)
func (*SegmentDocValuesProducer) GetMergeInstance ¶
func (s *SegmentDocValuesProducer) GetMergeInstance() DocValuesProducer
func (*SegmentDocValuesProducer) GetNumeric ¶
func (s *SegmentDocValuesProducer) GetNumeric(field *document.FieldInfo) (NumericDocValues, error)
func (*SegmentDocValuesProducer) GetSorted ¶
func (s *SegmentDocValuesProducer) GetSorted(field *document.FieldInfo) (SortedDocValues, error)
func (*SegmentDocValuesProducer) GetSortedNumeric ¶
func (s *SegmentDocValuesProducer) GetSortedNumeric(field *document.FieldInfo) (SortedNumericDocValues, error)
func (*SegmentDocValuesProducer) GetSortedSet ¶
func (s *SegmentDocValuesProducer) GetSortedSet(field *document.FieldInfo) (SortedSetDocValues, error)
type SegmentInfo ¶
SegmentInfo Information about a segment such as its name, directory, and files related to the segment.
func NewSegmentInfo ¶
func (*SegmentInfo) AddFile ¶
func (s *SegmentInfo) AddFile(file string) error
AddFile Add this file to the set of files written for this segment.
func (*SegmentInfo) Dir ¶
func (s *SegmentInfo) Dir() store.Directory
func (*SegmentInfo) Files ¶
func (s *SegmentInfo) Files() map[string]struct{}
Files Return all files referenced by this SegmentInfo.
func (*SegmentInfo) GetAttributes ¶
func (s *SegmentInfo) GetAttributes() map[string]string
GetAttributes Returns the internal codec attributes map. Returns: internal codec attributes map.
func (*SegmentInfo) GetCodec ¶
func (s *SegmentInfo) GetCodec() Codec
func (*SegmentInfo) GetDiagnostics ¶
func (s *SegmentInfo) GetDiagnostics() map[string]string
GetDiagnostics Returns diagnostics saved into the segment when it was written. The map is immutable.
func (*SegmentInfo) GetID ¶
func (s *SegmentInfo) GetID() []byte
func (*SegmentInfo) GetIndexSort ¶
func (s *SegmentInfo) GetIndexSort() *Sort
func (*SegmentInfo) GetMinVersion ¶
func (s *SegmentInfo) GetMinVersion() *version.Version
func (*SegmentInfo) GetUseCompoundFile ¶
func (s *SegmentInfo) GetUseCompoundFile() bool
GetUseCompoundFile Returns true if this segment is stored as a compound file; else, false.
func (*SegmentInfo) GetVersion ¶
func (s *SegmentInfo) GetVersion() *version.Version
func (*SegmentInfo) MaxDoc ¶
func (s *SegmentInfo) MaxDoc() (int, error)
MaxDoc Returns number of documents in this segment (deletions are not taken into account).
func (*SegmentInfo) Name ¶
func (s *SegmentInfo) Name() string
func (*SegmentInfo) NamedForThisSegment ¶
func (s *SegmentInfo) NamedForThisSegment(file string) string
NamedForThisSegment strips any segment name from the file, naming it with this segment this is because "segment names" can change, e.g. by addIndexes(Dir)
func (*SegmentInfo) PutAttribute ¶
func (s *SegmentInfo) PutAttribute(key, value string) string
PutAttribute Puts a codec attribute item. This is a key-item mapping for the field that the codec can use to store additional metadata, and will be available to the codec when reading the segment via getAttribute(String) If a item already exists for the field, it will be replaced with the new item. This method make a copy on write for every attribute change.
func (*SegmentInfo) SetCodec ¶
func (s *SegmentInfo) SetCodec(codec Codec)
func (*SegmentInfo) SetDiagnostics ¶
func (s *SegmentInfo) SetDiagnostics(diagnostics map[string]string)
func (*SegmentInfo) SetFiles ¶
func (s *SegmentInfo) SetFiles(files map[string]struct{})
func (*SegmentInfo) SetMaxDoc ¶
func (s *SegmentInfo) SetMaxDoc(maxDoc int) error
func (*SegmentInfo) SetUseCompoundFile ¶
func (s *SegmentInfo) SetUseCompoundFile(isCompoundFile bool)
SetUseCompoundFile Mark whether this segment is stored as a compound file. Params: isCompoundFile – true if this is a compound file; else, false
type SegmentInfoFormat ¶
type SegmentInfoFormat interface { // Read SegmentInfo data from a directory. // dir: directory to read from // segmentName: name of the segment to read // segmentID: expected identifier for the segment Read(ctx context.Context, dir store.Directory, segmentName string, segmentID []byte, context *store.IOContext) (*SegmentInfo, error) // Write SegmentInfo data. // The codec must add its SegmentInfo filename(s) to {@code info} before doing i/o. Write(ctx context.Context, dir store.Directory, info *SegmentInfo, ioContext *store.IOContext) error }
SegmentInfoFormat Expert: Controls the format of the SegmentInfo (segment metadata file). @see SegmentInfo @lucene.experimental
type SegmentInfos ¶
type SegmentInfos struct {
// contains filtered or unexported fields
}
SegmentInfos A collection of segmentInfo objects with methods for operating on those segments in relation to the file system. The active segments in the index are stored in the segment info file, segments_N. There may be one or more segments_N files in the index; however, the one with the largest generation is the active one (when older segments_N files are present it's because they temporarily cannot be deleted, or a custom IndexDeletionPolicy is in use). This file lists each segment by name and has details about the codec and generation of deletes. Files:
- segments_N: Header, LuceneVersion, Version, NameCounter, SegCount, MinSegmentLuceneVersion, <SegName, SegID, SegCodec, DelGen, DeletionCount, FieldInfosGen, DocValuesGen, UpdatesFiles>SegCount, CommitUserData, Footer
Data types:
- Header --> IndexHeader
- LuceneVersion --> Which Lucene code Version was used for this commit, written as three vInt: major, minor, bugfix
- MinSegmentLuceneVersion --> Lucene code Version of the oldest segment, written as three vInt: major, minor, bugfix; this is only written only if there's at least one segment
- NameCounter, SegCount, DeletionCount --> Int32
- Generation, Version, DelGen, Checksum, FieldInfosGen, DocValuesGen --> Int64
- SegID --> Int8ID_LENGTH
- SegName, SegCodec --> String
- CommitUserData --> Map<String,String>
- UpdatesFiles --> Map<Int32, Set<String>>
- Footer --> CodecFooter
Field Descriptions:
- Version counts how often the index has been Changed by adding or deleting documents.
- NameCounter is used to generate names for new segment files.
- SegName is the name of the segment, and is used as the file name prefix for all of the files that compose the segment's index.
- DelGen is the generation count of the deletes file. If this is -1, there are no deletes. Anything above zero means there are deletes stored by LiveDocsFormat.
- DeletionCount records the number of deleted documents in this segment.
- SegCodec is the name of the Codec that encoded this segment.
- SegID is the identifier of the Codec that encoded this segment.
- CommitUserData stores an optional user-supplied opaque Map<String,String> that was passed to IndexWriter.setLiveCommitData(Iterable).
- FieldInfosGen is the generation count of the fieldInfos file. If this is -1, there are no updates to the fieldInfos in that segment. Anything above zero means there are updates to fieldInfos stored by FieldInfosFormat .
- DocValuesGen is the generation count of the updatable DocValues. If this is -1, there are no updates to DocValues in that segment. Anything above zero means there are updates to DocValues stored by DocValuesFormat.
- UpdatesFiles stores the set of files that were updated in that segment per field.
lucene.experimental
func NewSegmentInfos ¶
func NewSegmentInfos(indexCreatedVersionMajor int) *SegmentInfos
func ReadCommit ¶
func ReadCommitFromChecksum ¶
func ReadCommitFromChecksum(ctx context.Context, directory store.Directory, input store.ChecksumIndexInput, generation int64) (*SegmentInfos, error)
ReadCommitFromChecksum Read the commit from the provided ChecksumIndexInput.
func ReadLatestCommit ¶
ReadLatestCommit Find the latest commit (segments_N file) and load all SegmentCommitInfos.
func (*SegmentInfos) Add ¶
func (i *SegmentInfos) Add(si *SegmentCommitInfo) error
func (*SegmentInfos) AddAll ¶
func (i *SegmentInfos) AddAll(sis []*SegmentCommitInfo)
func (*SegmentInfos) AsList ¶
func (i *SegmentInfos) AsList() []*SegmentCommitInfo
func (*SegmentInfos) Changed ¶
func (i *SegmentInfos) Changed()
Changed Call this before committing if changes have been made to the segments.
func (*SegmentInfos) Clone ¶
func (i *SegmentInfos) Clone() *SegmentInfos
Clone Returns a copy of this instance, also copying each SegmentInfo.
func (*SegmentInfos) CreateBackupSegmentInfos ¶
func (i *SegmentInfos) CreateBackupSegmentInfos() []*SegmentCommitInfo
func (*SegmentInfos) Files ¶
func (i *SegmentInfos) Files(includeSegmentsFile bool) (map[string]struct{}, error)
func (*SegmentInfos) GetGeneration ¶
func (i *SegmentInfos) GetGeneration() int64
func (*SegmentInfos) GetLastGeneration ¶
func (i *SegmentInfos) GetLastGeneration() int64
func (*SegmentInfos) GetSegmentsFileName ¶
func (i *SegmentInfos) GetSegmentsFileName() string
func (*SegmentInfos) GetUserData ¶
func (i *SegmentInfos) GetUserData() map[string]string
func (*SegmentInfos) GetVersion ¶
func (i *SegmentInfos) GetVersion() int64
func (*SegmentInfos) Info ¶
func (i *SegmentInfos) Info(j int) *SegmentCommitInfo
func (*SegmentInfos) Remove ¶
func (i *SegmentInfos) Remove(index int)
func (*SegmentInfos) Replace ¶
func (i *SegmentInfos) Replace(other *SegmentInfos)
func (*SegmentInfos) SetNextWriteGeneration ¶
func (i *SegmentInfos) SetNextWriteGeneration(generation int64)
func (*SegmentInfos) Size ¶
func (i *SegmentInfos) Size() int
func (*SegmentInfos) TotalMaxDoc ¶
func (i *SegmentInfos) TotalMaxDoc() int64
func (*SegmentInfos) UpdateGeneration ¶
func (i *SegmentInfos) UpdateGeneration(other *SegmentInfos)
func (*SegmentInfos) UpdateGenerationVersionAndCounter ¶
func (i *SegmentInfos) UpdateGenerationVersionAndCounter(other *SegmentInfos)
type SegmentMap ¶
type SegmentMap struct {
// contains filtered or unexported fields
}
func NewSegmentMap ¶
func NewSegmentMap(weight []int64) *SegmentMap
func (*SegmentMap) NewToOld ¶
func (s *SegmentMap) NewToOld(segment int) int
func (*SegmentMap) OldToNew ¶
func (s *SegmentMap) OldToNew(segment int) int
type SegmentMerger ¶
type SegmentMerger struct {
// contains filtered or unexported fields
}
The SegmentMerger class combines two or more Segments, represented by an IndexReader, into a single Segment. Call the merge method to combine the segments.
func NewSegmentMerger ¶
func NewSegmentMerger(readers []CodecReader, segmentInfo *SegmentInfo, dir store.Directory, fieldNumbers *FieldNumbers, ioCtx *store.IOContext) (*SegmentMerger, error)
func (*SegmentMerger) ShouldMerge ¶
func (s *SegmentMerger) ShouldMerge() bool
type SegmentReadState ¶
type SegmentReadState struct { //Directory where this segment is read from. Directory store.Directory // SegmentInfo describing this segment. SegmentInfo *SegmentInfo // FieldInfos describing all fields in this segment. FieldInfos *FieldInfos // IOContext to pass to Directory.openInput(String, IOContext). Context *store.IOContext // Unique suffix for any postings files read for this segment. // PerFieldPostingsFormat sets this for each of the postings formats it wraps. // If you create a new PostingsFormat then any files you write/read must be derived // using this suffix (use IndexFileNames.segmentFileName(String, String, String)). SegmentSuffix string }
SegmentReadState Holder class for common parameters used during read. lucene.experimental
func NewSegmentReadState ¶
func NewSegmentReadState(dir store.Directory, info *SegmentInfo, fieldInfos *FieldInfos, context *store.IOContext, segmentSuffix string) *SegmentReadState
type SegmentReader ¶
type SegmentReader struct { *BaseCodecReader // contains filtered or unexported fields }
SegmentReader Reader implementation over a single segment. Instances pointing to the same segment (but with different deletes, etc) may share the same core data. lucene.experimental
func NewSegmentReader ¶
func NewSegmentReader(si *SegmentCommitInfo, createdVersionMajor int, context *store.IOContext) (*SegmentReader, error)
func NewSegmentReaderV1 ¶
func NewSegmentReaderV1(si *SegmentCommitInfo, sr *SegmentReader, liveDocs, hardLiveDocs util.Bits, numDocs int, isNRT bool) (*SegmentReader, error)
func (*SegmentReader) Directory ¶
func (s *SegmentReader) Directory() store.Directory
func (*SegmentReader) DoClose ¶
func (s *SegmentReader) DoClose() error
func (*SegmentReader) GetDocValuesReader ¶
func (s *SegmentReader) GetDocValuesReader() DocValuesProducer
func (*SegmentReader) GetFieldInfos ¶
func (s *SegmentReader) GetFieldInfos() *FieldInfos
func (*SegmentReader) GetFieldsReader ¶
func (s *SegmentReader) GetFieldsReader() StoredFieldsReader
func (*SegmentReader) GetHardLiveDocs ¶
func (s *SegmentReader) GetHardLiveDocs() util.Bits
GetHardLiveDocs Returns the live docs that are not hard-deleted. This is an expert API to be used with soft-deletes to filter out document that hard deleted for instance due to aborted documents or to distinguish soft and hard deleted documents ie. a rolled back tombstone. lucene.experimental
func (*SegmentReader) GetLiveDocs ¶
func (s *SegmentReader) GetLiveDocs() util.Bits
func (*SegmentReader) GetMetaData ¶
func (s *SegmentReader) GetMetaData() *LeafMetaData
func (*SegmentReader) GetNormsReader ¶
func (s *SegmentReader) GetNormsReader() NormsProducer
func (*SegmentReader) GetOriginalSegmentInfo ¶
func (s *SegmentReader) GetOriginalSegmentInfo() *SegmentCommitInfo
GetOriginalSegmentInfo Returns the original SegmentInfo passed to the segment reader on creation time. getSegmentInfo() returns a clone of this instance.
func (*SegmentReader) GetPointsReader ¶
func (s *SegmentReader) GetPointsReader() PointsReader
func (*SegmentReader) GetPostingsReader ¶
func (s *SegmentReader) GetPostingsReader() FieldsProducer
func (*SegmentReader) GetReaderCacheHelper ¶
func (s *SegmentReader) GetReaderCacheHelper() CacheHelper
func (*SegmentReader) GetTermVectorsReader ¶
func (s *SegmentReader) GetTermVectorsReader() TermVectorsReader
func (*SegmentReader) MaxDoc ¶
func (s *SegmentReader) MaxDoc() int
func (*SegmentReader) NumDocs ¶
func (s *SegmentReader) NumDocs() int
type SegmentWriteState ¶
type SegmentWriteState struct { // Directory where this segment will be written to. Directory store.Directory // SegmentInfo describing this segment. SegmentInfo *SegmentInfo // FieldInfos describing all fields in this segment. FieldInfos *FieldInfos // Number of deleted documents set while flushing the segment. DelCountOnFlush int // Number of only soft deleted documents set while flushing the segment. SoftDelCountOnFlush int // Deletes and updates to apply while we are flushing the segment. A Term is enrolled in here if // it was deleted/updated at one point, and it's mapped to the docIDUpto, meaning any docID < docIDUpto // containing this term should be deleted/updated. SegUpdates *BufferedUpdates // FixedBitSet recording live documents; this is only set if there is one or more deleted documents. LiveDocs *bitset.BitSet // Unique suffix for any postings files written for this segment. PerFieldPostingsFormat sets this for each of the postings formats it wraps. If you create a new PostingsFormat then any files you write/read must be derived using this suffix (use IndexFileNames.segmentFileName(String, String, String)). Note: the suffix must be either empty, or be a textual suffix contain exactly two parts (separated by underscore), or be a base36 generation. SegmentSuffix string // IOContext for all writes; you should pass this to Directory.createOutput(String, IOContext). Context *store.IOContext }
SegmentWriteState Holder class for common parameters used during write.
func NewSegmentWriteState ¶
func NewSegmentWriteState(directory store.Directory, segmentInfo *SegmentInfo, fieldInfos *FieldInfos, segUpdates *BufferedUpdates) *SegmentWriteState
type SimScorer ¶
type SimScorer interface { // Score a single document. freq is the document-term sloppy frequency and must be finite and positive. // norm is the encoded normalization factor as computed by computeNorm(FieldInvertState) at index time, // or 1 if norms are disabled. norm is never 0. // Score must not decrease when freq increases, ie. if freq1 > freq2, // then Score(freq1, norm) >= Score(freq2, norm) for any item of norm that may be produced by // computeNorm(FieldInvertState). // Score must not increase when the unsigned norm increases, ie. if Long.compareUnsigned(norm1, norm2) > 0 // then Score(freq, norm1) <= Score(freq, norm2) for any legal freq. // As a consequence, the maximum Score that this scorer can produce is bound by Score(Float.MAX_VALUE, 1). // Params: freq – sloppy term frequency, must be finite and positive // norm – encoded normalization factor or 1 if norms are disabled // Returns: document's Score Score(freq float64, norm int64) float64 Explain(freq *types.Explanation, norm int64) (*types.Explanation, error) }
SimScorer Stores the weight for a query across the indexed collection. This abstract implementation is empty; descendants of Similarity should subclass SimWeight and define the statistics they require in the subclass. Examples include idf, average field length, etc.
type SimScorerDefault ¶
type SimScorerDefault struct {
SimScorerSPI
}
func NewSimScorerDefault ¶
func NewSimScorerDefault(simScorerSPI SimScorerSPI) *SimScorerDefault
func (*SimScorerDefault) Explain ¶
func (s *SimScorerDefault) Explain(freq *types.Explanation, norm int64) (*types.Explanation, error)
type SimScorerSPI ¶
type Similarity ¶
type Similarity interface { // ComputeNorm Computes the normalization item for a field, given the accumulated state of term processing // for this field (see FieldInvertState). // Matches in longer fields are less precise, so implementations of this method usually set smaller values // when state.getLength() is large, and larger values when state.getLength() is small. // Note that for a given term-document frequency, greater unsigned norms must produce scores that are // lower or equal, ie. for two encoded norms n1 and n2 so that Long.compareUnsigned(n1, n2) > 0 then // SimScorer.Score(freq, n1) <= SimScorer.Score(freq, n2) for any legal freq. // 0 is not a legal norm, so 1 is the norm that produces the highest scores. // Params: state – current processing state for this field // Returns: computed norm item ComputeNorm(state *FieldInvertState) int64 // Scorer Compute any collection-level weight (e.g. IDF, average document length, etc) needed for scoring a query. // Params: boost – a multiplicative factor to apply to the produces scores // collectionStats – collection-level statistics, such as the number of tokens in the collection. // termStats – term-level statistics, such as the document frequency of a term across the collection. // Returns: SimWeight object with the information this Similarity needs to score a query. Scorer(boost float64, collectionStats *types.CollectionStatistics, termStats []types.TermStatistics) SimScorer }
Similarity defines the components of Lucene scoring. Expert: Scoring API. This is a low-level API, you should only extend this API if you want to implement an information retrieval model. If you are instead looking for a convenient way to alter Lucene's scoring, consider just tweaking the default implementation: BM25Similarity or extend SimilarityBase, which makes it easy to compute a score from index statistics. Similarity determines how Lucene weights terms, and Lucene interacts with this class at both index-time and query-time. Indexing Time At indexing time, the indexer calls computeNorm(FieldInvertState), allowing the Similarity implementation to set a per-document item for the field that will be later accessible via org.apache.lucene.index.LeafReader.getNormValues(String). Lucene makes no assumption about what is in this norm, but it is most useful for encoding length normalization information. Implementations should carefully consider how the normalization is encoded: while Lucene's BM25Similarity encodes length normalization information with SmallFloat into a single byte, this might not be suitable for all purposes. Many formulas require the use of average document length, which can be computed via a combination of CollectionStatistics.sumTotalTermFreq() and CollectionStatistics.docCount(). Additional scoring factors can be stored in named NumericDocValuesFields and accessed at query-time with org.apache.lucene.index.LeafReader.getNumericDocValues(String). However this should not be done in the Similarity but externally, for instance by using FunctionScoreQuery. Finally, using index-time boosts (either via folding into the normalization byte or via DocValues), is an inefficient way to boost the scores of different fields if the boost will be the same for every document, instead the Similarity can simply take a constant boost parameter C, and PerFieldSimilarityWrapper can return different instances with different boosts depending upon field name. Query time At query-time, Queries interact with the Similarity via these steps: The scorer(float, CollectionStatistics, TermStatistics...) method is called a single time, allowing the implementation to compute any statistics (such as IDF, average document length, etc) across the entire collection. The TermStatistics and CollectionStatistics passed in already contain all of the raw statistics involved, so a Similarity can freely use any combination of statistics without causing any additional I/O. Lucene makes no assumption about what is stored in the returned Similarity.SimScorer object. Then Similarity.SimScorer.score(float, long) is called for every matching document to compute its score. Explanations When IndexSearcher.explain(org.apache.lucene.search.Query, int) is called, queries consult the Similarity's DocScorer for an explanation of how it computed its score. The query passes in a the document id and an explanation of how the frequency was computed. See Also: org.apache.lucene.index.IndexWriterConfig.setSimilarity(Similarity), IndexSearcher.setSimilarity(Similarity)
type SingleTermsEnum ¶
type SingleTermsEnum struct { *FilteredTermsEnumBase // contains filtered or unexported fields }
SingleTermsEnum Subclass of FilteredTermsEnum for enumerating a single term. For example, this can be used by MultiTermQuerys that need only visit one term, but want to preserve MultiTermQuery semantics such as MultiTermQuery.getRewriteMethod.
func NewSingleTermsEnum ¶
func NewSingleTermsEnum(tenum TermsEnum, termText []byte) *SingleTermsEnum
func (*SingleTermsEnum) Accept ¶
func (s *SingleTermsEnum) Accept(term []byte) (AcceptStatus, error)
type SingleValueDocValuesFieldUpdates ¶
type SingleValueDocValuesFieldUpdates struct { }
type SkipBuffer ¶
type SkipBuffer struct { *store.BaseIndexInput // contains filtered or unexported fields }
SkipBuffer used to buffer the top skip levels
func NewSkipBuffer ¶
func NewSkipBuffer(in store.IndexInput, length int) (*SkipBuffer, error)
func (*SkipBuffer) Clone ¶
func (s *SkipBuffer) Clone() store.CloneReader
func (*SkipBuffer) Close ¶
func (s *SkipBuffer) Close() error
func (*SkipBuffer) GetFilePointer ¶
func (s *SkipBuffer) GetFilePointer() int64
func (*SkipBuffer) Length ¶
func (s *SkipBuffer) Length() int64
func (*SkipBuffer) ReadByte ¶
func (s *SkipBuffer) ReadByte() (byte, error)
func (*SkipBuffer) Slice ¶
func (s *SkipBuffer) Slice(sliceDescription string, offset, length int64) (store.IndexInput, error)
type SlowImpactsEnum ¶
type SlowImpactsEnum struct {
// contains filtered or unexported fields
}
func NewSlowImpactsEnum ¶
func NewSlowImpactsEnum(delegate PostingsEnum) *SlowImpactsEnum
func (*SlowImpactsEnum) AdvanceShallow ¶
func (s *SlowImpactsEnum) AdvanceShallow(target int) error
func (*SlowImpactsEnum) Cost ¶
func (s *SlowImpactsEnum) Cost() int64
func (*SlowImpactsEnum) DocID ¶
func (s *SlowImpactsEnum) DocID() int
func (*SlowImpactsEnum) EndOffset ¶
func (s *SlowImpactsEnum) EndOffset() (int, error)
func (*SlowImpactsEnum) Freq ¶
func (s *SlowImpactsEnum) Freq() (int, error)
func (*SlowImpactsEnum) GetImpacts ¶
func (s *SlowImpactsEnum) GetImpacts() (Impacts, error)
func (*SlowImpactsEnum) GetPayload ¶
func (s *SlowImpactsEnum) GetPayload() ([]byte, error)
func (*SlowImpactsEnum) NextDoc ¶
func (s *SlowImpactsEnum) NextDoc() (int, error)
func (*SlowImpactsEnum) NextPosition ¶
func (s *SlowImpactsEnum) NextPosition() (int, error)
func (*SlowImpactsEnum) SlowAdvance ¶
func (s *SlowImpactsEnum) SlowAdvance(target int) (int, error)
func (*SlowImpactsEnum) StartOffset ¶
func (s *SlowImpactsEnum) StartOffset() (int, error)
type Sort ¶
type Sort struct {
// contains filtered or unexported fields
}
type SortField ¶
type SortField interface { // GetMissingValue Return the item to use for documents that don't have a item. // A item of null indicates that default should be used. GetMissingValue() any // SetMissingValue Set the item to use for documents that don't have a item. SetMissingValue(missingValue any) error // GetField Returns the name of the field. Could return null if the sort is by SCORE or DOC. // Returns: Name of field, possibly null. GetField() string // GetType Returns the type of contents in the field. // Returns: One of the constants SCORE, DOC, STRING, INT or FLOAT. GetType() SortFieldType // GetReverse Returns whether the sort should be reversed. // Returns: True if natural order should be reversed. GetReverse() bool GetComparatorSource() FieldComparatorSource // SetCanUsePoints For numeric sort fields, setting this field, indicates that the same numeric data // has been indexed with two fields: doc values and points and that these fields have the same name. // This allows to use sort optimization and skip non-competitive documents. SetCanUsePoints() GetCanUsePoints() bool SetBytesComparator(fn BytesComparator) GetBytesComparator() BytesComparator // GetComparator Returns the FieldComparator to use for sorting. //Params: numHits – number of top hits the queue will store // sortPos – position of this SortField within Sort. The comparator is primary if // sortPos==0, secondary if sortPos==1, etc. Some comparators can optimize // themselves when they are the primary sort. //Returns: FieldComparator to use when sorting //lucene.experimental GetComparator(numHits, sortPos int) FieldComparator GetIndexSorter() IndexSorter Serialize(ctx context.Context, out store.DataOutput) error Equals(other SortField) bool String() string }
SortField Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them. Created: Feb 11, 2004 1:25:29 PM Since: lucene 1.4 See Also: Sort
type SortFieldProvider ¶
type SortFieldProvider interface { NamedSPI // ReadSortField Reads a SortField from serialized bytes ReadSortField(ctx context.Context, in store.DataInput) (SortField, error) // WriteSortField Writes a SortField to a DataOutput This is used to record index // ort information in segment headers WriteSortField(ctx context.Context, sf SortField, out store.DataOutput) error }
SortFieldProvider Reads/Writes a named SortField from a segment info file, used to record index sorts
func GetSortFieldProviderByName ¶
func GetSortFieldProviderByName(name string) SortFieldProvider
type SortFieldType ¶
type SortFieldType int
SortFieldType Specifies the type of the terms to be sorted, or special types such as CUSTOM
func (SortFieldType) String ¶
func (s SortFieldType) String() string
type SortedDocValues ¶
type SortedDocValues interface { BinaryDocValues // OrdValue Returns the ordinal for the current docID. It is illegal to call this method after // advanceExact(int) returned false. // Returns: ordinal for the document: this is dense, starts at 0, then increments by 1 for the // next item in sorted order. OrdValue() (int, error) // LookupOrd Retrieves the item for the specified ordinal. The returned BytesRef may be re-used // across calls to lookupOrd(int) so make sure to copy it if you want to keep it around. // Params: ord – ordinal to lookup (must be >= 0 and < FnGetValueCount()) // See Also: FnOrdValue() LookupOrd(ord int) ([]byte, error) // GetValueCount Returns the number of unique values. // Returns: number of unique values in this SortedDocValues. This is also equivalent to one plus the maximum ordinal. GetValueCount() int // LookupTerm If key exists, returns its ordinal, else returns -insertionPoint-1, like Arrays.binarySearch. // Params: key – key to look up LookupTerm(key []byte) (int, error) // TermsEnum Returns a TermsEnum over the values. The enum supports TermsEnum.ord() and TermsEnum.seekExact(long). TermsEnum() (TermsEnum, error) // Intersect Returns a TermsEnum over the values, filtered by a CompiledAutomaton The enum supports TermsEnum.ord(). Intersect(automaton *automaton.CompiledAutomaton) (TermsEnum, error) }
SortedDocValues A per-document byte[] with presorted values. This is fundamentally an iterator over the int ord values per document, with random access APIs to resolve an int ord to BytesRef. Per-Document values in a SortedDocValues are deduplicated, dereferenced, and sorted into a dictionary of unique values. A pointer to the dictionary item (ordinal) can be retrieved for each document. Ordinals are dense and in increasing sorted order.
func GetSorted ¶
func GetSorted(reader LeafReader, field string) (SortedDocValues, error)
type SortedDocValuesProvider ¶
type SortedDocValuesProvider interface {
Get(reader LeafReader) (SortedDocValues, error)
}
SortedDocValuesProvider Provide a SortedDocValues instance for a LeafReader
type SortedDocValuesTermsEnum ¶
type SortedDocValuesTermsEnum struct { }
SortedDocValuesTermsEnum Creates a new TermsEnum over the provided values
func NewSortedDocValuesTermsEnum ¶
func NewSortedDocValuesTermsEnum(values SortedDocValues) *SortedDocValuesTermsEnum
func (*SortedDocValuesTermsEnum) Attributes ¶
func (s *SortedDocValuesTermsEnum) Attributes() *attribute.Source
func (*SortedDocValuesTermsEnum) DocFreq ¶
func (s *SortedDocValuesTermsEnum) DocFreq() (int, error)
func (*SortedDocValuesTermsEnum) Impacts ¶
func (s *SortedDocValuesTermsEnum) Impacts(flags int) (ImpactsEnum, error)
func (*SortedDocValuesTermsEnum) Next ¶
func (s *SortedDocValuesTermsEnum) Next(context.Context) ([]byte, error)
func (*SortedDocValuesTermsEnum) Ord ¶
func (s *SortedDocValuesTermsEnum) Ord() (int64, error)
func (*SortedDocValuesTermsEnum) Postings ¶
func (s *SortedDocValuesTermsEnum) Postings(reuse PostingsEnum, flags int) (PostingsEnum, error)
func (*SortedDocValuesTermsEnum) SeekCeil ¶
func (s *SortedDocValuesTermsEnum) SeekCeil(ctx context.Context, text []byte) (SeekStatus, error)
func (*SortedDocValuesTermsEnum) SeekExactByOrd ¶
func (s *SortedDocValuesTermsEnum) SeekExactByOrd(ctx context.Context, ord int64) error
func (*SortedDocValuesTermsEnum) SeekExactExpert ¶
func (*SortedDocValuesTermsEnum) Term ¶
func (s *SortedDocValuesTermsEnum) Term() ([]byte, error)
func (*SortedDocValuesTermsEnum) TermState ¶
func (s *SortedDocValuesTermsEnum) TermState() (TermState, error)
func (*SortedDocValuesTermsEnum) TotalTermFreq ¶
func (s *SortedDocValuesTermsEnum) TotalTermFreq() (int64, error)
type SortedDocValuesWriter ¶
type SortedDocValuesWriter struct { }
func (*SortedDocValuesWriter) Flush ¶
func (s *SortedDocValuesWriter) Flush(state *SegmentWriteState, sortMap DocMap, consumer DocValuesConsumer) error
func (*SortedDocValuesWriter) GetDocValues ¶
func (s *SortedDocValuesWriter) GetDocValues() types.DocIdSetIterator
type SortedNumericDocValues ¶
type SortedNumericDocValues interface { types.DocValuesIterator // NextValue Iterates to the next item in the current document. Do not call this more than // docValueCount times for the document. NextValue() (int64, error) // DocValueCount Retrieves the number of values for the current document. This must always be greater // than zero. It is illegal to call this method after advanceExact(int) returned false. DocValueCount() int }
SortedNumericDocValues A list of per-document numeric values, sorted according to Long.CompareFn(long, long).
type SortedNumericDocValuesWriter ¶
type SortedNumericDocValuesWriter struct { }
func (*SortedNumericDocValuesWriter) Flush ¶
func (s *SortedNumericDocValuesWriter) Flush(state *SegmentWriteState, sortMap DocMap, consumer DocValuesConsumer) error
func (*SortedNumericDocValuesWriter) GetDocValues ¶
func (s *SortedNumericDocValuesWriter) GetDocValues() types.DocIdSetIterator
type SortedSetDocValues ¶
type SortedSetDocValues interface { types.DocValuesIterator // NextOrd Returns the next ordinal for the current document. // It is illegal to call this method after advanceExact(int) returned false. // 返回当前文档的下一个序数。在AdvanceExact(int)返回false之后调用此方法是非法的。 NextOrd() (int64, error) // LookupOrd Retrieves the value for the specified ordinal. // The returned BytesRef may be re-used across calls to lookupOrd // so make sure to copy it if you want to keep it around. LookupOrd(ord int64) ([]byte, error) GetValueCount() int64 }
SortedSetDocValues A multi-valued version of SortedDocValues. Per-Document values in a SortedSetDocValues are deduplicated, dereferenced, and sorted into a dictionary of unique values. A pointer to the dictionary item (ordinal) can be retrieved for each document. Ordinals are dense and in increasing sorted order.
type SortedSetDocValuesWriter ¶
type SortedSetDocValuesWriter struct { }
func (*SortedSetDocValuesWriter) Flush ¶
func (s *SortedSetDocValuesWriter) Flush(state *SegmentWriteState, sortMap DocMap, consumer DocValuesConsumer) error
func (*SortedSetDocValuesWriter) GetDocValues ¶
func (s *SortedSetDocValuesWriter) GetDocValues() types.DocIdSetIterator
type SortedSetSelector ¶
type SortedSetSelector struct { }
SortedSetSelector Selects a item from the document's set to use as the representative item
type SortedSetSelectorType ¶
type SortedSetSelectorType int
type SortedSetSortField ¶
type SortedSetSortField struct { *BaseSortField // contains filtered or unexported fields }
SortedSetSortField SortField for SortedSetDocValues. A SortedSetDocValues contains multiple values for a field, so sorting with this technique "selects" a item as the representative sort item for the document. By default, the minimum item in the set is selected as the sort item, but this can be customized. Selectors other than the default do have some limitations to ensure that all selections happen in constant-time for performance. Like sorting by string, this also supports sorting missing values as first or last, via setMissingValue(Object). See Also: SortedSetSelector
func NewSortedSetSortField ¶
func NewSortedSetSortField(field string, reverse bool) *SortedSetSortField
func NewSortedSetSortFieldV1 ¶
func NewSortedSetSortFieldV1(field string, reverse bool, selector SortedSetSelectorType) *SortedSetSortField
type SortedSetSortFieldProvider ¶
type SortedSetSortFieldProvider struct { }
func NewSortedSetSortFieldProvider ¶
func NewSortedSetSortFieldProvider() *SortedSetSortFieldProvider
func (*SortedSetSortFieldProvider) GetName ¶
func (s *SortedSetSortFieldProvider) GetName() string
func (*SortedSetSortFieldProvider) ReadSortField ¶
func (*SortedSetSortFieldProvider) WriteSortField ¶
func (s *SortedSetSortFieldProvider) WriteSortField(ctx context.Context, sf SortField, out store.DataOutput) error
type Sorter ¶
type Sorter interface { // Compare entries found in slots i and j. The contract for the returned item is the same as cmp.CompareFn(Object, Object). Compare(i, j int) int Swap(i, j int) int }
Sorter Base class for sorting algorithms implementations. lucene.internal
type SorterDefault ¶
type SorterDefault struct {
// contains filtered or unexported fields
}
type SortingNumericDocValues ¶
type SortingNumericDocValues struct {
// contains filtered or unexported fields
}
func (*SortingNumericDocValues) Advance ¶
func (s *SortingNumericDocValues) Advance(target int) (int, error)
func (*SortingNumericDocValues) AdvanceExact ¶
func (s *SortingNumericDocValues) AdvanceExact(target int) (bool, error)
func (*SortingNumericDocValues) Cost ¶
func (s *SortingNumericDocValues) Cost() int64
func (*SortingNumericDocValues) DocID ¶
func (s *SortingNumericDocValues) DocID() int
func (*SortingNumericDocValues) LongValue ¶
func (s *SortingNumericDocValues) LongValue() (int64, error)
func (*SortingNumericDocValues) NextDoc ¶
func (s *SortingNumericDocValues) NextDoc() (int, error)
func (*SortingNumericDocValues) SlowAdvance ¶
func (s *SortingNumericDocValues) SlowAdvance(target int) (int, error)
type StandardDirectoryReader ¶
type StandardDirectoryReader struct { *DirectoryReaderDefault // contains filtered or unexported fields }
StandardDirectoryReader Default implementation of DirectoryReader.
func NewStandardDirectoryReader ¶
func NewStandardDirectoryReader(directory store.Directory, readers []Reader, writer *Writer, sis *SegmentInfos, leafSorter func(a, b LeafReader) int, applyAllDeletes, writeAllDeletes bool) (*StandardDirectoryReader, error)
NewStandardDirectoryReader package private constructor, called only from static open() methods
func OpenStandardDirectoryReader ¶
func OpenStandardDirectoryReader(writer *Writer, readerFunction func(*SegmentCommitInfo) (*SegmentReader, error), infos *SegmentInfos, applyAllDeletes, writeAllDeletes bool) (*StandardDirectoryReader, error)
OpenStandardDirectoryReader Used by near real-time search
func (*StandardDirectoryReader) GetIndexCommit ¶
func (s *StandardDirectoryReader) GetIndexCommit() (IndexCommit, error)
func (*StandardDirectoryReader) GetSegmentInfos ¶
func (s *StandardDirectoryReader) GetSegmentInfos() *SegmentInfos
func (*StandardDirectoryReader) GetVersion ¶
func (s *StandardDirectoryReader) GetVersion() int64
type StoredFieldsConsumer ¶
type StoredFieldsConsumer struct {
// contains filtered or unexported fields
}
func NewStoredFieldsConsumer ¶
func NewStoredFieldsConsumer(codec Codec, dir store.Directory, info *SegmentInfo) *StoredFieldsConsumer
func (*StoredFieldsConsumer) Finish ¶
func (s *StoredFieldsConsumer) Finish(maxDoc int) error
func (*StoredFieldsConsumer) FinishDocument ¶
func (s *StoredFieldsConsumer) FinishDocument() error
func (*StoredFieldsConsumer) Flush ¶
func (s *StoredFieldsConsumer) Flush(state *SegmentWriteState, sortMap *DocMap) error
func (*StoredFieldsConsumer) StartDocument ¶
func (s *StoredFieldsConsumer) StartDocument(docID int) error
type StoredFieldsFormat ¶
type StoredFieldsFormat interface { // FieldsReader Returns a StoredFieldsReader to load stored fields. FieldsReader(directory store.Directory, si *SegmentInfo, fn *FieldInfos, context *store.IOContext) (StoredFieldsReader, error) // FieldsWriter Returns a StoredFieldsWriter to write stored fields. FieldsWriter(directory store.Directory, si *SegmentInfo, context *store.IOContext) (StoredFieldsWriter, error) }
type StoredFieldsReader ¶
type StoredFieldsReader interface { io.Closer // VisitDocument Visit the stored fields for document docID VisitDocument(docID int, visitor document.StoredFieldVisitor) error Clone() StoredFieldsReader // CheckIntegrity Checks consistency of this reader. // Note that this may be costly in terms of I/O, e.g. may involve computing a checksum // item against large data files. // lucene.internal CheckIntegrity() error // GetMergeInstance Returns an instance optimized for merging. This instance may not be cloned. //The default implementation returns this GetMergeInstance() StoredFieldsReader }
type StoredFieldsWriter ¶
type StoredFieldsWriter interface { io.Closer // StartDocument Called before writing the stored fields of the document. writeField(FieldInfo, IndexableField) will be called for each stored field. Note that this is called even if the document has no stored fields. StartDocument() error // FinishDocument Called when a document and all its fields have been added. FinishDocument() error // WriteField Writes a single stored field. WriteField(info *document.FieldInfo, field document.IndexableField) error // Finish Called before close(), passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls to startDocument(), but a Codec should check that this is the case to detect the JRE bug described in LUCENE-1282. Finish(fis *FieldInfos, numDocs int) error }
StoredFieldsWriter Codec API for writing stored fields: 1. For every document, startDocument() is called, informing the Codec that a new document has started. 2. writeField(FieldInfo, IndexableField) is called for each field in the document. 3. After all documents have been written, finish(FieldInfos, int) is called for verification/sanity-checks. 4. Finally the writer is closed (close()) lucene.experimental
type StringDocComparator ¶
type StringDocComparator struct {
// contains filtered or unexported fields
}
func (*StringDocComparator) Compare ¶
func (s *StringDocComparator) Compare(docID1, docID2 int) int
type StringSorter ¶
type StringSorter struct {
// contains filtered or unexported fields
}
func NewStringSorter ¶
func NewStringSorter(providerName, missingValue string, reverse bool, valuesProvider SortedDocValuesProvider) *StringSorter
func (*StringSorter) GetComparableProviders ¶
func (s *StringSorter) GetComparableProviders(readers []LeafReader) ([]ComparableProvider, error)
func (*StringSorter) GetDocComparator ¶
func (s *StringSorter) GetDocComparator(reader LeafReader, maxDoc int) (DocComparator, error)
func (*StringSorter) GetProviderName ¶
func (s *StringSorter) GetProviderName() string
type Term ¶
type Term struct {
// contains filtered or unexported fields
}
A Term represents a word from text. This is the unit of search. It is composed of two elements, the text of the word, as a string, and the name of the field that the text occurred in. Note that terms may represent more than words from text fields, but also things like dates, email addresses, urls, etc.
type TermData ¶
type TermData struct {
// contains filtered or unexported fields
}
func NewTermData ¶
func NewTermData(text string, docs []int, positions [][]PositionData) *TermData
type TermDataList ¶
type TermDataList []*TermData
func (TermDataList) Len ¶
func (t TermDataList) Len() int
func (TermDataList) Less ¶
func (t TermDataList) Less(i, j int) bool
func (TermDataList) Swap ¶
func (t TermDataList) Swap(i, j int)
type TermNode ¶
type TermNode struct {
// contains filtered or unexported fields
}
func NewTermNode ¶
type TermState ¶
type TermState interface { // CopyFrom // Copies the content of the given TermState to this instance // other – the TermState to copy CopyFrom(other TermState) }
TermState Encapsulates all required internal state to position the associated TermsEnum without re-seeking. See Also: TermsEnum.seekExact(org.apache.lucene.util.BytesRef, TermState), TermsEnum.termState()
var (
EMPTY_TERMSTATE TermState
)
type TermStates ¶
type TermStates struct {
// contains filtered or unexported fields
}
TermStates Maintains a Reader TermState view over Reader instances containing a single term. The TermStates doesn't track if the given TermState objects are valid, neither if the TermState instances refer to the same terms in the associated readers.
func BuildTermStates ¶
func BuildTermStates(context ReaderContext, term *Term, needsStats bool) (*TermStates, error)
BuildTermStates Creates a TermStates from a top-level ReaderContext and the given Term. This method will lookup the given term in all context's leaf readers and register each of the readers containing the term in the returned TermStates using the leaf reader's ordinal. Note: the given context must be a top-level context. Params: needsStats – if true then all leaf contexts will be visited up-front to collect term statistics.
Otherwise, the TermState objects will be built only when requested
func NewTermStates ¶
func NewTermStates(term *Term, context ReaderContext) *TermStates
func (*TermStates) AccumulateStatistics ¶
func (r *TermStates) AccumulateStatistics(docFreq int, totalTermFreq int64)
AccumulateStatistics Expert: Accumulate term statistics.
func (*TermStates) DocFreq ¶
func (r *TermStates) DocFreq() (int, error)
DocFreq Returns the accumulated document frequency of all TermState instances passed to register(TermState, int, int, long). Returns: the accumulated document frequency of all TermState instances passed to register(TermState, int, int, long).
func (*TermStates) Get ¶
func (r *TermStates) Get(ctx *LeafReaderContext) (TermState, error)
Get Returns the TermState for a leaf reader context or null if no TermState for the context was registered. Params: ctx – the LeafReaderContext to get the TermState for. Returns: the TermState for the given readers ord or null if no TermState for the reader was
func (*TermStates) Register ¶
func (r *TermStates) Register(state TermState, ord, docFreq int, totalTermFreq int64)
func (*TermStates) Register2 ¶
func (r *TermStates) Register2(state TermState, ord int)
Register2 Expert: Registers and associates a TermState with an leaf ordinal. The leaf ordinal should be derived from a ReaderContext's leaf ord. On the contrary to register(TermState, int, int, long) this method does NOT update term statistics.
func (*TermStates) TotalTermFreq ¶
func (r *TermStates) TotalTermFreq() (int64, error)
TotalTermFreq Returns the accumulated term frequency of all TermState instances passed to register(TermState, int, int, long). Returns: the accumulated term frequency of all TermState instances passed to register(TermState, int, int, long).
func (*TermStates) WasBuiltFor ¶
func (r *TermStates) WasBuiltFor(context ReaderContext) bool
type TermVectorsConsumer ¶
type TermVectorsConsumer struct { *BaseTermsHash // contains filtered or unexported fields }
func NewTermVectorsConsumer ¶
func NewTermVectorsConsumer(intBlockAllocator ints.IntsAllocator, byteBlockAllocator bytesref.Allocator, directory store.Directory, info *SegmentInfo, codec Codec) *TermVectorsConsumer
func (*TermVectorsConsumer) AddField ¶
func (t *TermVectorsConsumer) AddField(invertState *FieldInvertState, fieldInfo *document.FieldInfo) (TermsHashPerField, error)
func (*TermVectorsConsumer) FinishDocument ¶
func (t *TermVectorsConsumer) FinishDocument(docID int) error
func (*TermVectorsConsumer) Flush ¶
func (t *TermVectorsConsumer) Flush(fieldsToFlush map[string]TermsHashPerField, state *SegmentWriteState, sortMap *DocMap, norms NormsProducer) error
func (*TermVectorsConsumer) SetTermBytePool ¶
func (t *TermVectorsConsumer) SetTermBytePool(termBytePool *bytesref.BlockPool)
type TermVectorsConsumerPerField ¶
type TermVectorsConsumerPerField struct { *TermsHashPerFieldDefault // contains filtered or unexported fields }
func NewTermVectorsConsumerPerField ¶
func NewTermVectorsConsumerPerField(invertState *FieldInvertState, termsHash *TermVectorsConsumer, fieldInfo *document.FieldInfo) (*TermVectorsConsumerPerField, error)
func (*TermVectorsConsumerPerField) AddTerm ¶
func (t *TermVectorsConsumerPerField) AddTerm(termID, docID int) error
func (*TermVectorsConsumerPerField) CreatePostingsArray ¶
func (t *TermVectorsConsumerPerField) CreatePostingsArray(size int) ParallelPostingsArray
func (*TermVectorsConsumerPerField) Finish ¶
func (t *TermVectorsConsumerPerField) Finish() error
func (*TermVectorsConsumerPerField) FinishDocument ¶
func (t *TermVectorsConsumerPerField) FinishDocument() error
func (*TermVectorsConsumerPerField) NewPostingsArray ¶
func (t *TermVectorsConsumerPerField) NewPostingsArray()
func (*TermVectorsConsumerPerField) NewTerm ¶
func (t *TermVectorsConsumerPerField) NewTerm(termID, docID int) error
func (*TermVectorsConsumerPerField) Reset ¶
func (t *TermVectorsConsumerPerField) Reset() error
func (*TermVectorsConsumerPerField) Start ¶
func (t *TermVectorsConsumerPerField) Start(field document.IndexableField, first bool) bool
type TermVectorsConsumerPerFields ¶
type TermVectorsConsumerPerFields []*TermVectorsConsumerPerField
func (TermVectorsConsumerPerFields) Len ¶
func (p TermVectorsConsumerPerFields) Len() int
func (TermVectorsConsumerPerFields) Less ¶
func (p TermVectorsConsumerPerFields) Less(i, j int) bool
func (TermVectorsConsumerPerFields) Swap ¶
func (p TermVectorsConsumerPerFields) Swap(i, j int)
type TermVectorsFormat ¶
type TermVectorsFormat interface { // VectorsReader Returns a TermVectorsReader to read term vectors. VectorsReader(dir store.Directory, segmentInfo *SegmentInfo, fieldInfos *FieldInfos, context *store.IOContext) (TermVectorsReader, error) // VectorsWriter Returns a TermVectorsWriter to write term vectors. VectorsWriter(dir store.Directory, segmentInfo *SegmentInfo, context *store.IOContext) (TermVectorsWriter, error) }
TermVectorsFormat Controls the format of term vectors
type TermVectorsPostingsArray ¶
type TermVectorsPostingsArray struct { *ParallelPostingsArrayDefault // contains filtered or unexported fields }
func NewTermVectorsPostingsArray ¶
func NewTermVectorsPostingsArray() *TermVectorsPostingsArray
func (*TermVectorsPostingsArray) BytesPerPosting ¶
func (t *TermVectorsPostingsArray) BytesPerPosting() int
func (*TermVectorsPostingsArray) Grow ¶
func (t *TermVectorsPostingsArray) Grow()
func (*TermVectorsPostingsArray) NewInstance ¶
func (t *TermVectorsPostingsArray) NewInstance() ParallelPostingsArray
func (*TermVectorsPostingsArray) SetFreqs ¶
func (t *TermVectorsPostingsArray) SetFreqs(termID, v int)
func (*TermVectorsPostingsArray) SetLastOffsets ¶
func (t *TermVectorsPostingsArray) SetLastOffsets(termID, v int)
func (*TermVectorsPostingsArray) SetLastPositions ¶
func (t *TermVectorsPostingsArray) SetLastPositions(termID, v int)
type TermVectorsReader ¶
type TermVectorsReader interface { io.Closer // Get Returns term vectors for this document, or null if term vectors were not indexed. // If offsets are available they are in an OffsetAttribute available from the // org.apache.lucene.index.PostingsEnum. Get(doc int) (Fields, error) // CheckIntegrity Checks consistency of this reader. // Note that this may be costly in terms of I/O, e.g. may involve computing a checksum // item against large data files. // lucene.internal CheckIntegrity() error // Clone Create a clone that one caller at a time may use to read term vectors. Clone() TermVectorsReader // GetMergeInstance Returns an instance optimized for merging. This instance may // only be consumed in the thread that called getMergeInstance(). // The default implementation returns this GetMergeInstance() TermVectorsReader }
TermVectorsReader Codec API for reading term vectors: lucene.experimental
type TermVectorsWriter ¶
type TermVectorsWriter interface { io.Closer // StartDocument Called before writing the term vectors of the document. startField(FieldInfo, int, boolean, boolean, boolean) will be called numVectorFields times. Note that if term vectors are enabled, this is called even if the document has no vector fields, in this case numVectorFields will be zero. StartDocument(numVectorFields int) error // FinishDocument Called after a doc and all its fields have been added. FinishDocument() error // StartField Called before writing the terms of the field. startTerm(BytesRef, int) will be called numTerms times. StartField(info *document.FieldInfo, numTerms int, positions, offsets, payloads bool) error // FinishField Called after a field and all its terms have been added. FinishField() error // StartTerm Adds a term and its term frequency freq. If this field has positions and/or offsets enabled, then addPosition(int, int, int, BytesRef) will be called freq times respectively. StartTerm(term []byte, freq int) error // FinishTerm Called after a term and all its positions have been added. FinishTerm() error // AddPosition Adds a term position and offsets AddPosition(position, startOffset, endOffset int, payload []byte) error // Finish Called before close(), passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls to startDocument(int), but a Codec should check that this is the case to detect the JRE bug described in LUCENE-1282. Finish(fis *FieldInfos, numDocs int) error }
TermVectorsWriter Codec API for writing term vectors: 1. For every document, startDocument(int) is called, informing the Codec how many fields will be written. 2. startField(FieldInfo, int, boolean, boolean, boolean) is called for each field in the document, informing the codec how many terms will be written for that field, and whether or not positions, offsets, or payloads are enabled. 3. Within each field, startTerm(BytesRef, int) is called for each term. 4. If offsets and/or positions are enabled, then addPosition(int, int, int, BytesRef) will be called for each term occurrence. 5. After all documents have been written, finish(FieldInfos, int) is called for verification/sanity-checks. 6. Finally the writer is closed (close()) lucene.experimental
type Terms ¶
type Terms interface { // Iterator // DVFUIterator Returns an iterator that will step through all terms. This method will not return null. Iterator() (TermsEnum, error) // Intersect Returns a TermsEnum that iterates over all terms and documents that are accepted by the // provided CompiledAutomaton. If the startTerm is provided then the returned enum will only return // terms > startTerm, but you still must call next() first to get to the first term. Note that the provided // startTerm must be accepted by the automaton. // This is an expert low-level API and will only work for NORMAL compiled automata. To handle any compiled // automata you should instead use CompiledAutomaton.getTermsEnum instead. // NOTE: the returned TermsEnum cannot seek Intersect(compiled *automaton.CompiledAutomaton, startTerm []byte) (TermsEnum, error) // Size Returns the number of terms for this field, or -1 if this measure isn't stored by the codec. // Note that, just like other term measures, this measure does not take deleted documents into account. Size() (int, error) // GetSumTotalTermFreq Returns the sum of TermsEnum.totalTermFreq for all terms in this field. Note that, // just like other term measures, this measure does not take deleted documents into account. GetSumTotalTermFreq() (int64, error) // GetSumDocFreq Returns the sum of TermsEnum.docFreq() for all terms in this field. Note that, // just like other term measures, this measure does not take deleted documents into account. GetSumDocFreq() (int64, error) // GetDocCount Returns the number of documents that have at least one term for this field. Note that, // just like other term measures, this measure does not take deleted documents into account. GetDocCount() (int, error) // HasFreqs Returns true if documents in this field store per-document term frequency (PostingsEnum.freq). HasFreqs() bool // HasOffsets Returns true if documents in this field store offsets. HasOffsets() bool // HasPositions Returns true if documents in this field store positions. HasPositions() bool // HasPayloads Returns true if documents in this field store payloads. HasPayloads() bool // GetMin Returns the smallest term (in lexicographic order) in the field. Note that, just like other // term measures, this measure does not take deleted documents into account. This returns null when // there are no terms. GetMin() ([]byte, error) // GetMax Returns the largest term (in lexicographic order) in the field. Note that, just like other term // measures, this measure does not take deleted documents into account. This returns null when there are no terms. GetMax() ([]byte, error) }
type TermsBase ¶
type TermsEnum ¶
type TermsEnum interface { Next(context.Context) ([]byte, error) // Attributes Returns the related attributes. Attributes() *attribute.Source // SeekExact Attempts to seek to the exact term, returning true if the term is found. If this returns false, // the enum is unpositioned. For some codecs, seekExact may be substantially faster than seekCeil. // Returns: true if the term is found; return false if the enum is unpositioned. SeekExact(ctx context.Context, text []byte) (bool, error) // SeekCeil eeks to the specified term, if it exists, or to the next (ceiling) term. Returns SeekStatus to // indicate whether exact term was found, a different term was found, or isEof was hit. The target term may be // before or after the current term. If this returns SeekStatus.END, the enum is unpositioned. SeekCeil(ctx context.Context, text []byte) (SeekStatus, error) // SeekExactByOrd Seeks to the specified term by ordinal (position) as previously returned by ord. The // target ord may be before or after the current ord, and must be within bounds. SeekExactByOrd(ctx context.Context, ord int64) error // SeekExactExpert Expert: Seeks a specific position by TermState previously obtained from termState(). // Callers should maintain the TermState to use this method. Low-level implementations may position the // TermsEnum without re-seeking the term dictionary. // Seeking by TermState should only be used iff the state was obtained from the same TermsEnum instance. // NOTE: Using this method with an incompatible TermState might leave this TermsEnum in undefined state. // On a segment level TermState instances are compatible only iff the source and the target TermsEnum operate // on the same field. If operating on segment level, TermState instances must not be used across segments. // NOTE: A seek by TermState might not restore the AttributeSourceV2's state. AttributeSourceV2 states must be // maintained separately if this method is used. // Params: term – the term the TermState corresponds to // state – the TermState SeekExactExpert(ctx context.Context, term []byte, state TermState) error // Term Returns current term. Do not call this when the enum is unpositioned. Term() ([]byte, error) // Ord Returns ordinal position for current term. This is an optional method (the codec may throw // ErrUnsupportedOperation). Do not call this when the enum is unpositioned. Ord() (int64, error) // DocFreq Returns the number of documents containing the current term. Do not call this when the // enum is unpositioned. TermsEnum.SeekStatus.END. DocFreq() (int, error) // TotalTermFreq Returns the total number of occurrences of this term across all documents (the sum of the // freq() for each doc that has this term). Note that, like other term measures, this measure does not // take deleted documents into account. TotalTermFreq() (int64, error) // Postings Get PostingsEnum for the current term, with control over whether freqs, positions, offsets or payloads are required. Do not call this when the enum is unpositioned. This method will not return null. // NOTE: the returned iterator may return deleted documents, so deleted documents have to be checked on top of the PostingsEnum. // Params: reuse – pass a prior PostingsEnum for possible reuse // flags – specifies which optional per-document values you require; see PostingsEnum.FREQS Postings(reuse PostingsEnum, flags int) (PostingsEnum, error) // Impacts Return a ImpactsEnum. // See Also: postings(PostingsEnum, int) Impacts(flags int) (ImpactsEnum, error) // TermState Expert: Returns the TermsEnums internal state to position the TermsEnum without re-seeking the // term dictionary. // NOTE: A seek by TermState might not capture the AttributeSourceV2's state. Callers must maintain the // AttributeSourceV2 states separately // See Also: TermState, seekExact(, TermState) TermState() (TermState, error) }
TermsEnum DVFUIterator to seek (seekCeil(), seekExact()) or step through (next terms to obtain frequency information (docFreq), PostingsEnum or PostingsEnum for the current term (postings. Term enumerations are always ordered by .compareTo, which is Unicode sort order if the terms are UTF-8 bytes. Each term in the enumeration is greater than the one before it. The TermsEnum is unpositioned when you first obtain it and you must first successfully call next or one of the seek methods.
type TermsEnumIndex ¶
type TermsEnumIndex struct {
// contains filtered or unexported fields
}
func NewTermsEnumIndex ¶
func NewTermsEnumIndex(termsEnum TermsEnum, subIndex int) *TermsEnumIndex
type TermsHash ¶
type TermsHash interface { Flush(fieldsToFlush map[string]TermsHashPerField, state *SegmentWriteState, sortMap *DocMap, norms NormsProducer) error AddField(fieldInvertState *FieldInvertState, fieldInfo *document.FieldInfo) (TermsHashPerField, error) SetTermBytePool(termBytePool *bytesref.BlockPool) FinishDocument(docID int) error Abort() error Reset() error StartDocument() error GetIntPool() *ints.BlockPool GetBytePool() *bytesref.BlockPool GetTermBytePool() *bytesref.BlockPool }
TermsHash This class is passed each token produced by the analyzer on each field during indexing, and it stores these tokens in a hash table, and allocates separate byte streams per token. Consumers of this class, eg FreqProxTermsWriter and TermVectorsConsumer, write their own byte streams under each term.
type TermsHashPerField ¶
type TermsHashPerField interface { // Start adding a new field instance; first is true if this is the first time this field name was seen in the document. Start(field document.IndexableField, first bool) bool Add(termBytes []byte, docID int) error Add2nd(textStart, docID int) error GetNextPerField() TermsHashPerField Finish() error Reset() error // NewTerm Called when a term is seen for the first time. NewTerm(termID, docID int) error // AddTerm Called when a previously seen term is seen again. AddTerm(termID, docID int) error // NewPostingsArray Called when the postings array is initialized or resized. NewPostingsArray() // CreatePostingsArray Creates a new postings array of the specified size. CreatePostingsArray(size int) ParallelPostingsArray GetPostingsArray() ParallelPostingsArray SetPostingsArray(v ParallelPostingsArray) }
TermsHashPerField This class stores streams of information per term without knowing the size of the stream ahead of time. Each stream typically encodes one level of information like term frequency per document or term proximity. Internally this class allocates a linked list of slices that can be read by a ByteSliceReader for each term. Terms are first deduplicated in a BytesHash once this is done internal data-structures point to the current offset of each stream that can be written to.
TermsHashPerField 可以存储每个term的信息,而不需要知道数据流的大小。 每个数据流通常编码一个级别的信息,如每个文档的术语频率(term's frequency)或术语接近度(term's proximity)。 在内部,此类为每个术语(term)分配 ByteSliceReader 可以读取的切片的链接列表。 完成后,首先在BytesRefHash中对术语(term)进行重复数据消除。内部数据结构指向可以写入的每个流的当前偏移量。
type TermsHashPerFieldDefault ¶
type TermsHashPerFieldDefault struct {
// contains filtered or unexported fields
}
func NewTermsHashPerFieldDefault ¶
func NewTermsHashPerFieldDefault(streamCount int, intPool *ints.BlockPool, bytePool, termBytePool *bytesref.BlockPool, nextPerField TermsHashPerField, fieldName string, indexOptions document.IndexOptions, perField TermsHashPerField) *TermsHashPerFieldDefault
func (*TermsHashPerFieldDefault) Add ¶
func (t *TermsHashPerFieldDefault) Add(termBytes []byte, docID int) error
Add Called once per inverted token. This is the primary entry point (for first TermsHash); postings use this API.
func (*TermsHashPerFieldDefault) Add2nd ¶
func (t *TermsHashPerFieldDefault) Add2nd(textStart, docID int) error
Add2nd Secondary entry point (for 2nd & subsequent TermsHash), because token text has already been "interned" into textStart, so we hash by textStart. term vectors use this API.
func (*TermsHashPerFieldDefault) Finish ¶
func (t *TermsHashPerFieldDefault) Finish() error
Finish adding all instances of this field to the current document.
func (*TermsHashPerFieldDefault) GetNextPerField ¶
func (t *TermsHashPerFieldDefault) GetNextPerField() TermsHashPerField
func (*TermsHashPerFieldDefault) GetPostingsArray ¶
func (t *TermsHashPerFieldDefault) GetPostingsArray() ParallelPostingsArray
func (*TermsHashPerFieldDefault) Reset ¶
func (t *TermsHashPerFieldDefault) Reset() error
func (*TermsHashPerFieldDefault) SetPostingsArray ¶
func (t *TermsHashPerFieldDefault) SetPostingsArray(v ParallelPostingsArray)
func (*TermsHashPerFieldDefault) Start ¶
func (t *TermsHashPerFieldDefault) Start(field document.IndexableField, first bool) bool
Start adding a new field instance; first is true if this is the first time this field name was seen in the document.
type TieredMergePolicy ¶
type TieredMergePolicy struct { *MergePolicyBase // contains filtered or unexported fields }
func (*TieredMergePolicy) FindForcedDeletesMerges ¶
func (t *TieredMergePolicy) FindForcedDeletesMerges(segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
func (*TieredMergePolicy) FindForcedMerges ¶
func (t *TieredMergePolicy) FindForcedMerges(segmentInfos *SegmentInfos, maxSegmentCount int, segmentsToMerge map[*SegmentCommitInfo]bool, mergeContext MergeContext) (*MergeSpecification, error)
func (*TieredMergePolicy) FindFullFlushMerges ¶
func (t *TieredMergePolicy) FindFullFlushMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
func (*TieredMergePolicy) FindMerges ¶
func (t *TieredMergePolicy) FindMerges(mergeTrigger MergeTrigger, segmentInfos *SegmentInfos, mergeContext MergeContext) (*MergeSpecification, error)
func (*TieredMergePolicy) GetNoCFSRatio ¶
func (t *TieredMergePolicy) GetNoCFSRatio() float64
func (*TieredMergePolicy) Size ¶
func (t *TieredMergePolicy) Size(info *SegmentCommitInfo, mergeContext MergeContext) (int64, error)
func (*TieredMergePolicy) UseCompoundFile ¶
func (t *TieredMergePolicy) UseCompoundFile(infos *SegmentInfos, mergedInfo *SegmentCommitInfo, mergeContext MergeContext) (bool, error)
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) AddDocument ¶
AddDocument Adds a document to this index. Note that if an Exception is hit (for example disk full) then the index will be consistent, but this document may not have been added. Furthermore, it's possible the index will have one segment in non-compound format even when using compound files (when a merge has partially succeeded).
This method periodically flushes pending documents to the Directory (see above), and also periodically triggers segment merges in the index according to the MergePolicy in use.
Merges temporarily consume space in the directory. The amount of space required is up to 1X the size of all segments being merged, when no readers/searchers are open against the index, and up to 2X the size of all segments being merged when readers/searchers are open against the index (see forceMerge(int) for details). The sequence of primitive merge operations performed is governed by the merge policy.
Note that each term in the document can be no longer than MAX_TERM_LENGTH in bytes, otherwise an IllegalArgumentException will be thrown.
Note that it's possible to create an invalid Unicode string in java if a UTF16 surrogate pair is malformed. In this case, the invalid characters are silently replaced with the Unicode replacement character U+FFFD.
Returns: The sequence number for this operation Throws: CorruptIndexException – if the index is corrupt
IOException – if there is a low-level IO error
func (*Writer) AddIndexesFromReaders ¶
func (w *Writer) AddIndexesFromReaders(readers ...CodecReader) (int64, error)
AddIndexesFromReaders Merges the provided indexes into this index. The provided IndexReaders are not closed. See addIndexes for details on transactional semantics, temporary free space required in the Directory, and non-CFS segments on an Exception. NOTE: empty segments are dropped by this method and not added to this index. NOTE: this merges all given LeafReaders in one merge. If you intend to merge a large number of readers, it may be better to call this method multiple times, each time with a small set of readers. In principle, if you use a merge policy with a mergeFactor or maxMergeAtOnce parameter, you should pass that many readers in one call. NOTE: this method does not call or make use of the MergeScheduler, so any custom bandwidth throttling is at the moment ignored.
func (*Writer) GetConfig ¶
func (w *Writer) GetConfig() *WriterConfig
func (*Writer) GetDirectory ¶
GetDirectory Returns the Directory used by this index.
func (*Writer) GetReader ¶
func (w *Writer) GetReader(applyAllDeletes bool, writeAllDeletes bool) (DirectoryReader, error)
func (*Writer) IncRefDeleter ¶
func (w *Writer) IncRefDeleter(segmentInfos *SegmentInfos) error
func (*Writer) MaybeMerge ¶
func (*Writer) Release ¶
func (w *Writer) Release(readersAndUpdates *ReadersAndUpdates) error
func (*Writer) SoftUpdateDocument ¶
func (w *Writer) SoftUpdateDocument(ctx context.Context, term *Term, doc *document.Document, softDeletes ...document.IndexableField) (int64, error)
SoftUpdateDocument Expert: Updates a document by first updating the document(s) containing term with the given doc-values fields and then adding the new document. The doc-values update and then add are atomic as seen by a reader on the same index (flush may happen only after the add). One use of this API is to retain older versions of documents instead of replacing them. The existing documents can be updated to reflect they are no longer current while atomically adding new documents at the same time. In contrast to updateDocument(Term, Iterable) this method will not delete documents in the index matching the given term but instead update them with the given doc-values fields which can be used as a soft-delete mechanism. See addDocuments(Iterable) and updateDocuments(Term, Iterable).
Returns: The sequence number for this operation Throws: CorruptIndexException: if the index is corrupt IOException: if there is a low-level IO error
func (*Writer) UpdateDocument ¶
func (w *Writer) UpdateDocument(ctx context.Context, term *Term, doc *document.Document) (int64, error)
UpdateDocument Updates a document by first deleting the document(s) containing term and then adding the new document. The delete and then add are atomic as seen by a reader on the same index (Flush may happen only after the add). Params: term – the term to identify the document(s) to be deleted doc – the document to be added Returns: The sequence number for this operation Throws: CorruptIndexException – if the index is corrupt
IOException – if there is a low-level IO error
type WriterConfig ¶
func NewWriterConfig ¶
func NewWriterConfig(codec Codec, similarity Similarity) *WriterConfig
func (WriterConfig) GetAnalyzer ¶
func (*WriterConfig) GetCommitOnClose ¶
func (c *WriterConfig) GetCommitOnClose() bool
GetCommitOnClose Returns true if IndexWriter.close() should first commit before closing.
func (*WriterConfig) GetFlushPolicy ¶
func (c *WriterConfig) GetFlushPolicy() FlushPolicy
func (*WriterConfig) GetIndexCommit ¶
func (c *WriterConfig) GetIndexCommit() IndexCommit
GetIndexCommit Returns the IndexCommit as specified in IndexWriterConfig.setIndexCommit(IndexCommit) or the default, null which specifies to open the latest index commit point.
func (*WriterConfig) GetIndexCreatedVersionMajor ¶
func (c *WriterConfig) GetIndexCreatedVersionMajor() int
func (WriterConfig) GetIndexDeletionPolicy ¶
func (r WriterConfig) GetIndexDeletionPolicy() IndexDeletionPolicy
func (WriterConfig) GetIndexSort ¶
func (r WriterConfig) GetIndexSort() *Sort
func (WriterConfig) GetIndexSortFields ¶
func (r WriterConfig) GetIndexSortFields() map[string]struct{}
func (WriterConfig) GetIndexingChain ¶
func (r WriterConfig) GetIndexingChain() IndexingChain
func (WriterConfig) GetLeafSorter ¶
func (r WriterConfig) GetLeafSorter() func(a, b LeafReader) int
func (WriterConfig) GetMaxBufferedDocs ¶
func (r WriterConfig) GetMaxBufferedDocs() int
func (WriterConfig) GetMaxFullFlushMergeWaitMillis ¶
func (r WriterConfig) GetMaxFullFlushMergeWaitMillis() int64
func (WriterConfig) GetMergePolicy ¶
func (r WriterConfig) GetMergePolicy() MergePolicy
func (*WriterConfig) GetMergeScheduler ¶
func (c *WriterConfig) GetMergeScheduler() MergeScheduler
func (WriterConfig) GetMergedSegmentWarmer ¶
func (r WriterConfig) GetMergedSegmentWarmer() ReaderWarmer
func (*WriterConfig) GetOpenMode ¶
func (c *WriterConfig) GetOpenMode() OpenMode
func (WriterConfig) GetReaderPooling ¶
func (r WriterConfig) GetReaderPooling() bool
func (WriterConfig) GetSimilarity ¶
func (r WriterConfig) GetSimilarity() Similarity
GetSimilarity Expert: returns the Similarity implementation used by this IndexWriter.
func (WriterConfig) GetSoftDeletesField ¶
func (r WriterConfig) GetSoftDeletesField() string
func (WriterConfig) GetUseCompoundFile ¶
func (r WriterConfig) GetUseCompoundFile() bool
func (WriterConfig) IsCheckPendingFlushOnUpdate ¶
func (r WriterConfig) IsCheckPendingFlushOnUpdate() bool
func (WriterConfig) SetCheckPendingFlushUpdate ¶
func (r WriterConfig) SetCheckPendingFlushUpdate(checkPendingFlushOnUpdate bool)
func (*WriterConfig) SetIndexSort ¶
func (c *WriterConfig) SetIndexSort(sort *Sort) error
SetIndexSort Set the Sort order to use for all (flushed and merged) segments.
func (WriterConfig) SetMaxBufferedDocs ¶
func (r WriterConfig) SetMaxBufferedDocs(maxBufferedDocs int)
func (WriterConfig) SetMergePolicy ¶
func (r WriterConfig) SetMergePolicy(mergePolicy MergePolicy)
func (WriterConfig) SetMergedSegmentWarmer ¶
func (r WriterConfig) SetMergedSegmentWarmer(mergeSegmentWarmer ReaderWarmer)
func (WriterConfig) SetUseCompoundFile ¶
func (r WriterConfig) SetUseCompoundFile(useCompoundFile bool)
Source Files ¶
- automatontermsenum.go
- basecompositereader.go
- basetermsenum.go
- binarydocvalues.go
- bitsetiterator.go
- bufferedupdates.go
- bufferedupdatesstream.go
- byteslicereader.go
- checkindex.go
- codec.go
- codecreader.go
- codecsdesign.go
- codecspointswriter.go
- competitiveimpactaccumulator.go
- compositereader.go
- concurrentmergescheduler.go
- datafields.go
- defaultindexingchain.go
- directoryreader.go
- docconsumer.go
- docidset.go
- docswithfieldset.go
- documentswriter.go
- documentswriterdeletequeue.go
- documentswriterflushcontrol.go
- documentswriterflushqueue.go
- documentswriterperthread.go
- documentswriterperthreadpool.go
- docvalues.go
- docvaluesfieldupdates.go
- docvaluesleafreader.go
- docvaluesupdate.go
- emptydocvaluesproducer.go
- eventqueue.go
- fieldcomparator.go
- fielddata.go
- fieldinfos.go
- fieldinvertstate.go
- fields.go
- fieldupdatesbuffer.go
- filteredtermsenum.go
- filterleafreader.go
- flushpolicy.go
- freqproxfields.go
- freqproxpostingsarray.go
- freqproxtermswriter.go
- freqproxtermswriterperfield.go
- frozenbufferedupdates.go
- impact.go
- indexcommit.go
- indexdeletionpolicy.go
- indexfiledeleter.go
- indexfilenames.go
- indexreadercontext.go
- indexsorter.go
- interface.go
- leaffieldcomparator.go
- leafmetadata.go
- leafreader.go
- liveindexwriterconfig.go
- logbytesizemergepolicy.go
- logdocmergepolicy.go
- mergepolicy.go
- mergescheduler.go
- mergesource.go
- mergestate.go
- mergetrigger.go
- multilevelskiplistreader.go
- multilevelskiplistwriter.go
- multisorter.go
- mutablepointsreaderutils.go
- node.go
- norms.go
- numericdocvalues.go
- ordinalmap.go
- pagedbytes.go
- parallelpostingsarray.go
- pendingdeletes.go
- pendingsoftdeletes.go
- pointvalueswriter.go
- postingsenum.go
- prefixcodedterms.go
- reader.go
- readerpool.go
- readersandupdates.go
- readerutil.go
- scorable.go
- segmentcommitinfo.go
- segmentcorereaders.go
- segmentdocvalues.go
- segmentinfo.go
- segmentinfos.go
- segmentmerger.go
- segmentreader.go
- segmentstate.go
- similarity.go
- singletermsenum.go
- slowimpactsenum.go
- sort.go
- sorteddocvalues.go
- sorteddocvaluestermsenum.go
- sortednumericdocvalues.go
- sortedsetdocvalues.go
- sortedsetdocvalueswriter.go
- sortedsetselector.go
- sortedsetsortfield.go
- sorter.go
- sortfield.go
- sortfieldprovider.go
- standarddirectoryreader.go
- storedfieldsconsumer.go
- term.go
- terms.go
- termsenum.go
- termshash.go
- termshashperfield.go
- termstates.go
- termvectorsconsumer.go
- termvectorsconsumerperfield.go
- termvectorspostingsarray.go
- tieredmergepolicy.go
- writer.go
- writerconfig.go