kvindex

package
v0.0.0-...-fa720cf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_index_proto protoreflect.FileDescriptor

Functions

func DocKey

func DocKey(docID string) []byte

DocKey create a document entry key

func EntryKey

func EntryKey(field string, ttype TermType, term []byte, docid string) []byte

EntryKey create a key for an entry

func EntryPrefix

func EntryPrefix(field string) []byte

EntryPrefix get prefix for all entries for a single field

func EntryTypePrefix

func EntryTypePrefix(field string, ttype TermType) []byte

EntryTypePrefix get prefix for all entries for a single field

func EntryValuePrefix

func EntryValuePrefix(field string, ttype TermType, term []byte) []byte

EntryValuePrefix get prefix for all terms for a field

func FieldKey

func FieldKey(field string) []byte

FieldKey produces the byte key for a particular graph

func FieldKeyParse

func FieldKeyParse(key []byte) string

FieldKeyParse extracts the string name of a graph from a byte key

func FieldPrefix

func FieldPrefix() []byte

FieldPrefix returns the byte array prefix for all graph entry keys

func GetBytesTerm

func GetBytesTerm(val []byte, ttype TermType) interface{}

GetBytesTerm converts the bytes representation of a term back to its original value

func TermKey

func TermKey(field string, ttype TermType, term []byte) []byte

TermKey create a key for a term index

func TermPrefix

func TermPrefix(field string) []byte

TermPrefix get a prefix for all the terms for a single field

func TermTypePrefix

func TermTypePrefix(field string, ttype TermType) []byte

TermTypePrefix get a prefix for all the terms of a particular type for a single field

Types

type Doc

type Doc struct {
	Entries [][]byte `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	// contains filtered or unexported fields
}

func (*Doc) Descriptor deprecated

func (*Doc) Descriptor() ([]byte, []int)

Deprecated: Use Doc.ProtoReflect.Descriptor instead.

func (*Doc) GetEntries

func (x *Doc) GetEntries() [][]byte

func (*Doc) ProtoMessage

func (*Doc) ProtoMessage()

func (*Doc) ProtoReflect

func (x *Doc) ProtoReflect() protoreflect.Message

func (*Doc) Reset

func (x *Doc) Reset()

func (*Doc) String

func (x *Doc) String() string

type KVIndex

type KVIndex struct {
	KV     kvi.KVInterface
	Fields map[string][]string
}

KVIndex is a index implementation using the generic key value store

func NewIndex

func NewIndex(kv kvi.KVInterface) *KVIndex

NewIndex create new key value index

func (*KVIndex) AddDoc

func (idx *KVIndex) AddDoc(docID string, value map[string]interface{}) error

AddDoc adds new document to the index

func (*KVIndex) AddDocTx

func (idx *KVIndex) AddDocTx(tx kvi.KVBulkWrite, docID string, doc map[string]interface{}) error

AddDocTx add new document using a transaction provided by user

func (*KVIndex) AddField

func (idx *KVIndex) AddField(path string) error

AddField add new field to be indexed

func (*KVIndex) FieldNumbers

func (idx *KVIndex) FieldNumbers(field string) chan float64

FieldNumbers returns all entries values, in numeric order

func (*KVIndex) FieldStringTermCounts

func (idx *KVIndex) FieldStringTermCounts(field string) chan KVTermCount

FieldStringTermCounts get all terms, that are strings, and their counts for a particular field

func (*KVIndex) FieldTermCounts

func (idx *KVIndex) FieldTermCounts(field string) chan KVTermCount

FieldTermCounts get all terms, and their counts for a particular field

func (*KVIndex) FieldTermNumberMax

func (idx *KVIndex) FieldTermNumberMax(field string) float64

FieldTermNumberMax finds the max number term for a field

func (*KVIndex) FieldTermNumberMin

func (idx *KVIndex) FieldTermNumberMin(field string) float64

FieldTermNumberMin for a field, get the min number term value

func (*KVIndex) FieldTermNumberRange

func (idx *KVIndex) FieldTermNumberRange(field string, min, max float64) chan KVTermCount

FieldTermNumberRange gets all number term counts between min and max

func (*KVIndex) FieldTerms

func (idx *KVIndex) FieldTerms(field string) chan interface{}

FieldTerms list all unique terms held by a field

func (*KVIndex) GetTermMatch

func (idx *KVIndex) GetTermMatch(ctx context.Context, field string, value interface{}, maxCount int) chan string

GetTermMatch find all documents where field has the value

func (*KVIndex) ListFields

func (idx *KVIndex) ListFields() []string

ListFields lists all indexed fields

func (*KVIndex) RemoveDoc

func (idx *KVIndex) RemoveDoc(docID string) error

RemoveDoc removes a document from the index: TODO

func (*KVIndex) RemoveField

func (idx *KVIndex) RemoveField(path string) error

RemoveField removes an indexed field

type KVTermCount

type KVTermCount struct {
	String string
	Number float64
	Count  uint64
}

KVTermCount Get all terms and their counts

type TermType

type TermType byte

TermType defines in a term is a Number or a String

const (
	//TermUnknown is an undefined term type
	TermUnknown TermType = 0x00
	//TermString means the term is a string
	TermString TermType = 0x01
	//TermNumber means the term is a number
	TermNumber TermType = 0x02
)

func EntryKeyParse

func EntryKeyParse(key []byte) (string, TermType, []byte, string)

EntryKeyParse take entry key and parse out field term and document id

func GetTermBytes

func GetTermBytes(term interface{}) ([]byte, TermType)

GetTermBytes converts a term into its bytes representation and returns its type

func TermKeyParse

func TermKeyParse(key []byte) (string, TermType, []byte)

TermKeyParse parse a term key into a field and a value

Jump to

Keyboard shortcuts

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