index

package
v0.1.8-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package index provides an inverted index that supports fulltext search.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index maps terms to object keys.

func New

func New() *Index

New returns InvertedIndex objects.

func (*Index) Get

func (idx *Index) Get(term string) []Posting

Get looks up a posting list in the search index using the given term.

func (*Index) Put

func (idx *Index) Put(terms []string, posting Posting)

Put adds a posting to the search index for each of the given terms.

type Posting

type Posting struct {
	Key  string
	Kind string
}

Posting represents an object Key and the kind of object the ID references.

func (Posting) DocID

func (p Posting) DocID() string

DocID is the document identifier, and it's a string with the form <Kind>/<Optional namespace>/<Object name>.

type PostingsList

type PostingsList []Posting

func (PostingsList) Len

func (p PostingsList) Len() int

func (PostingsList) Less

func (p PostingsList) Less(i, j int) bool

func (PostingsList) Swap

func (p PostingsList) Swap(i, j int)

Jump to

Keyboard shortcuts

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