tinysearch

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Iterate

func Iterate(iterator PostingListIterator) iter.Seq[DocID]

Types

type AndQuery

type AndQuery[DOCUMENT comparable] []Query[DOCUMENT]

type DocID

type DocID int64

type FieldValueExtractor

type FieldValueExtractor[DOCUMENT comparable] interface {
	// contains filtered or unexported methods
}

type InvertedIndex

type InvertedIndex[DOCUMENT comparable] struct {
	// contains filtered or unexported fields
}

func NewInvertedIndex

func NewInvertedIndex[DOCUMENT comparable](fields ...FieldValueExtractor[DOCUMENT]) *InvertedIndex[DOCUMENT]

func (*InvertedIndex[DOCUMENT]) Add

func (idx *InvertedIndex[DOCUMENT]) Add(doc DOCUMENT) bool

func (*InvertedIndex[DOCUMENT]) AddAll added in v0.0.1

func (idx *InvertedIndex[DOCUMENT]) AddAll(docs iter.Seq[DOCUMENT]) (added bool)

func (*InvertedIndex[DOCUMENT]) Docs added in v0.0.1

func (idx *InvertedIndex[DOCUMENT]) Docs() iter.Seq[DOCUMENT]

func (*InvertedIndex[DOCUMENT]) Query

func (idx *InvertedIndex[DOCUMENT]) Query(query Query[DOCUMENT]) iter.Seq[DOCUMENT]

func (*InvertedIndex[DOCUMENT]) Remove

func (idx *InvertedIndex[DOCUMENT]) Remove(doc DOCUMENT) bool

func (*InvertedIndex[DOCUMENT]) RemoveAll added in v0.0.1

func (idx *InvertedIndex[DOCUMENT]) RemoveAll(docs iter.Seq[DOCUMENT]) (removed bool)

type InvertedIndexField

type InvertedIndexField[DOCUMENT, FIELD comparable] struct {
	// contains filtered or unexported fields
}

func NewInvertedIndexField

func NewInvertedIndexField[DOCUMENT, FIELD comparable](
	extractFieldValues func(doc DOCUMENT, f func(value FIELD)),
) *InvertedIndexField[DOCUMENT, FIELD]

func (*InvertedIndexField[DOCUMENT, FIELD]) Query

func (f *InvertedIndexField[DOCUMENT, FIELD]) Query(value FIELD) Query[DOCUMENT]

type OrQuery

type OrQuery[DOCUMENT comparable] []Query[DOCUMENT]

type PostingList

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

func NewPostingList

func NewPostingList() *PostingList

func (*PostingList) Add

func (pl *PostingList) Add(docID DocID)

Add adds the given DocID to the end of the posting list. Noop if the given DocID is already in the posting list.

func (*PostingList) Iterator

func (pl *PostingList) Iterator() PostingListIterator

func (*PostingList) Remove

func (pl *PostingList) Remove(docID DocID) bool

Remove removes the given element from the list. Noop if the element was not already present. Returns true if the list is empty.

type PostingListIterator

type PostingListIterator interface {
	Peek() (DocID, bool)
	Next()
}
var EmptyIterator PostingListIterator = new(listIterator)

func NewAndIterator

func NewAndIterator(left, right PostingListIterator) PostingListIterator

func NewNotIterator

func NewNotIterator(positive, negative PostingListIterator) PostingListIterator

func NewOrIterator

func NewOrIterator(left, right PostingListIterator) PostingListIterator

type Query

type Query[DOCUMENT comparable] interface {
	// contains filtered or unexported methods
}

func NewAndQuery

func NewAndQuery[DOCUMENT comparable](ands ...Query[DOCUMENT]) Query[DOCUMENT]

func NewNotQuery

func NewNotQuery[DOCUMENT comparable](positive, negative Query[DOCUMENT]) Query[DOCUMENT]

func NewOrQuery

func NewOrQuery[DOCUMENT comparable](ors ...Query[DOCUMENT]) Query[DOCUMENT]

type QueryBuilder

type QueryBuilder[DOCUMENT, FIELD comparable] func(FIELD) Query[DOCUMENT]

Jump to

Keyboard shortcuts

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