mem

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dictionary

type Dictionary struct {
	// contains filtered or unexported fields
}

Dictionary is the in-memory representation of the term dictionary

func (*Dictionary) Iterator

func (d *Dictionary) Iterator() segment.DictionaryIterator

Iterator returns an iterator for this dictionary

func (*Dictionary) PostingsList

func (d *Dictionary) PostingsList(term string,
	except *roaring.Bitmap) (segment.PostingsList, error)

PostingsList returns the postings list for the specified term

func (*Dictionary) PrefixIterator

func (d *Dictionary) PrefixIterator(prefix string) segment.DictionaryIterator

PrefixIterator returns an iterator which only visits terms having the the specified prefix

func (*Dictionary) RangeIterator

func (d *Dictionary) RangeIterator(start, end string) segment.DictionaryIterator

RangeIterator returns an iterator which only visits terms between the start and end terms. NOTE: bleve.index API specifies the end is inclusive.

type DictionaryIterator

type DictionaryIterator struct {
	// contains filtered or unexported fields
}

DictionaryIterator is an iterator for term dictionary

func (*DictionaryIterator) Next

func (d *DictionaryIterator) Next() (*index.DictEntry, error)

Next returns the next entry in the dictionary

type Location

type Location struct {
	// contains filtered or unexported fields
}

Location represents the location of a single occurance

func (*Location) ArrayPositions

func (l *Location) ArrayPositions() []uint64

ArrayPositions returns the array position vector associated with this occurance

func (*Location) End

func (l *Location) End() uint64

End returns the end byte offset of this occurance

func (*Location) Field

func (l *Location) Field() string

Field returns the name of the field (useful in composite fields to know which original field the value came from)

func (*Location) Pos

func (l *Location) Pos() uint64

Pos returns the 1-based phrase position of this occurance

func (*Location) Start

func (l *Location) Start() uint64

Start returns the start byte offset of this occurance

type Posting

type Posting struct {
	// contains filtered or unexported fields
}

Posting is a single entry in a postings list

func (*Posting) Frequency

func (p *Posting) Frequency() uint64

Frequency returns the frequence of occurance of this term in this doc/field

func (*Posting) Locations

func (p *Posting) Locations() []segment.Location

Locations returns the location information for each occurance

func (*Posting) Norm

func (p *Posting) Norm() float64

Norm returns the normalization factor for this posting

func (*Posting) Number

func (p *Posting) Number() uint64

Number returns the document number of this posting in this segment

type PostingsIterator

type PostingsIterator struct {
	// contains filtered or unexported fields
}

PostingsIterator provides a way to iterate through the postings list

func (*PostingsIterator) Next

func (i *PostingsIterator) Next() (segment.Posting, error)

Next returns the next posting on the postings list, or nil at the end

type PostingsList

type PostingsList struct {
	// contains filtered or unexported fields
}

PostingsList is an in-memory represenation of a postings list

func (*PostingsList) Count

func (p *PostingsList) Count() uint64

Count returns the number of items on this postings list

func (*PostingsList) Iterator

func (p *PostingsList) Iterator() segment.PostingsIterator

Iterator returns an iterator for this postings list

type Segment

type Segment struct {

	// FieldsMap name -> id+1
	FieldsMap map[string]uint16
	// fields id -> name
	FieldsInv []string

	// term dictionary
	//  field id -> term -> posting id + 1
	Dicts []map[string]uint64

	// term dictionary keys
	//  field id -> []dictionary keys
	DictKeys [][]string

	// Postings list
	//  Postings list id -> Postings bitmap
	Postings []*roaring.Bitmap

	// Postings List has locations
	PostingsLocs []*roaring.Bitmap

	// term frequencies
	//  postings list id -> Freqs (one for each hit in bitmap)
	Freqs [][]uint64

	// field Norms
	//  postings list id -> Norms (one for each hit in bitmap)
	Norms [][]float32

	// field/start/end/pos/locarraypos
	//  postings list id -> start/end/pos/locarraypos (one for each freq)
	Locfields   [][]uint16
	Locstarts   [][]uint64
	Locends     [][]uint64
	Locpos      [][]uint64
	Locarraypos [][][]uint64

	// Stored field values
	//  docNum -> field id -> slice of values (each value []byte)
	Stored []map[uint16][][]byte

	// stored field types
	//  docNum -> field id -> slice of types (each type byte)
	StoredTypes []map[uint16][]byte

	// stored field array positions
	//  docNum -> field id -> slice of array positions (each is []uint64)
	StoredPos []map[uint16][][]uint64

	// for storing the docValue persisted fields
	DocValueFields map[uint16]bool
	// contains filtered or unexported fields
}

Segment is an in memory implementation of scorch.Segment

func New

func New() *Segment

New builds a new empty Segment

func NewFromAnalyzedDocs

func NewFromAnalyzedDocs(results []*index.AnalysisResult) *Segment

NewFromAnalyzedDocs places the analyzed document mutations into this segment

func (*Segment) AddRef

func (s *Segment) AddRef()

func (*Segment) Close

func (s *Segment) Close() error

Close releases all resources associated with this segment

func (*Segment) Count

func (s *Segment) Count() uint64

Count returns the number of documents in this segment (this has no notion of deleted docs)

func (*Segment) DecRef

func (s *Segment) DecRef() error

func (*Segment) Dictionary

func (s *Segment) Dictionary(field string) (segment.TermDictionary, error)

Dictionary returns the term dictionary for the specified field

func (*Segment) DocNumbers

func (s *Segment) DocNumbers(ids []string) (*roaring.Bitmap, error)

DocNumbers returns a bitset corresponding to the doc numbers of all the provided _id strings

func (*Segment) Fields

func (s *Segment) Fields() []string

Fields returns the field names used in this segment

func (*Segment) SizeInBytes

func (s *Segment) SizeInBytes() uint64

func (*Segment) VisitDocument

func (s *Segment) VisitDocument(num uint64, visitor segment.DocumentFieldValueVisitor) error

VisitDocument invokes the DocFieldValueVistor for each stored field for the specified doc number

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL