Documentation
¶
Index ¶
- Variables
- type BloomFiltersController
- func (bf *BloomFiltersController) Acquire() []uint64
- func (bf *BloomFiltersController) Add(data []uint64, s []byte)
- func (bf *BloomFiltersController) Debug(data []uint64, v []byte) string
- func (bf *BloomFiltersController) MayContain(data []uint64, s []byte) bool
- func (bf *BloomFiltersController) PreAllocate(n int)
- func (bf *BloomFiltersController) Release(v []uint64)
- func (bf *BloomFiltersController) Size() int
- type Index
- type Options
- type SearchEngine
- type TermsExtractor
- type Verifier
Constants ¶
This section is empty.
Variables ¶
var WithCustomMapper = func(f func(size, seed int) func([]byte) int) option { return func(opts *Options) { opts.CreateMapperFunc = f } }
var WithErrorRate = func(float64) option { panic("not implemented") }
WithErrorRate - calculate NMappers using expectations for number of elements inserted and false-positive error rate. See https://en.wikipedia.org/wiki/Bloom_filter#Probability_of_false_positives
var WithNMappers = func(nMappers int) option { return func(opts *Options) { opts.NMappers = nMappers } }
Functions ¶
This section is empty.
Types ¶
type BloomFiltersController ¶
type BloomFiltersController struct {
// contains filtered or unexported fields
}
func New ¶
func New(size int, opts ...option) *BloomFiltersController
func (*BloomFiltersController) Acquire ¶
func (bf *BloomFiltersController) Acquire() []uint64
Acquire - get a slice from pool / create new to use as a storage for a bloom filter.
func (*BloomFiltersController) Add ¶
func (bf *BloomFiltersController) Add(data []uint64, s []byte)
Add - encode string into data
func (*BloomFiltersController) Debug ¶
func (bf *BloomFiltersController) Debug(data []uint64, v []byte) string
Debug - print current data state in binary form and highlight bits, that represent value v.
func (*BloomFiltersController) MayContain ¶
func (bf *BloomFiltersController) MayContain(data []uint64, s []byte) bool
MayContain - check that data [possibly] contains s
func (*BloomFiltersController) PreAllocate ¶
func (bf *BloomFiltersController) PreAllocate(n int)
PreAllocate - pre-create several slices and put them into pool in advance to make Acquire() faster
func (*BloomFiltersController) Release ¶
func (bf *BloomFiltersController) Release(v []uint64)
Release - free v for future use
func (*BloomFiltersController) Size ¶
func (bf *BloomFiltersController) Size() int
Size - number of bits
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index - search index implementation using Bloom filters.
type SearchEngine ¶
type SearchEngine[T, Q any] struct { // contains filtered or unexported fields }
SearchEngine performs indexing and lookup operations for objects of type T
func NewSearchEngine ¶
func NewSearchEngine[T, Q any]( termsExtractor TermsExtractor[T, Q], verifier Verifier, indexOptions ...option, ) *SearchEngine[T, Q]
func (*SearchEngine[T, Q]) Index ¶
func (se *SearchEngine[T, Q]) Index(id uint64, input T)
func (*SearchEngine[T, Q]) Lookup ¶
func (se *SearchEngine[T, Q]) Lookup(query Q) ([]uint64, error)