ftsearch

package
v0.0.0-...-62c91b2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package search implements a simple full text search like Lucene.

Terminology: - document e.g. a page in the help or wiki - term is roughly a word

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder is an index using array for counts.

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Add

func (b *Builder) Add(id int, title, text string)

func (*Builder) Delete

func (b *Builder) Delete(id int, title, text string)

func (*Builder) ToIndex

func (b *Builder) ToIndex() *Index

type DocScore

type DocScore struct {
	DocId int
	Score float64
}

type Index

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

func NewIndex

func NewIndex() *Index

func Unpack

func Unpack[T bytes](buf T) *Index

func (*Index) Pack

func (ix *Index) Pack() []byte

func (*Index) Search

func (ix *Index) Search(query string) []DocScore

func (*Index) String

func (ix *Index) String() string

func (*Index) Update

func (ix *Index) Update(id int, oldTitle, oldText, newTitle, newText string)

func (*Index) WordInfo

func (ix *Index) WordInfo(s string) string

Jump to

Keyboard shortcuts

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