tantivy

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexRecordOptionBasic = iota
	IndexRecordOptionWithFreqs
	IndexRecordOptionWithFreqsAndPositions
)
View Source
const (
	Arabic     = "ar"
	Danish     = "da"
	Dutch      = "nl"
	English    = "en"
	Finnish    = "fi"
	French     = "fr"
	German     = "de"
	Greek      = "el"
	Hungarian  = "hu"
	Italian    = "it"
	Norwegian  = "no"
	Portuguese = "pt"
	Romanian   = "ro"
	Russian    = "ru"
	Spanish    = "es"
	Swedish    = "sv"
	Tamil      = "ta"
	Turkish    = "tr"
)
View Source
const DefaultTokenizer = "default"
View Source
const TokenizerEdgeNgram = "edge_ngram"
View Source
const TokenizerNgram = "ngram"
View Source
const TokenizerRaw = "raw"
View Source
const TokenizerSimple = "simple"

Variables

This section is empty.

Functions

func GetSearchResults

func GetSearchResults[T any](
	searchResult *SearchResult,
	schema *Schema,
	f func(json string) (T, error),
	includeFields ...string,
) ([]T, error)

func LibInit

func LibInit(directive ...string) error

func ToModel

func ToModel[T any](doc *Document, schema *Schema, includeFields []string, f func(json string) (T, error)) (T, error)

Types

type Document

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

func NewDocument

func NewDocument() *Document

func (*Document) AddField

func (d *Document) AddField(fieldName, fieldValue string, index *Index) error

func (*Document) Free

func (d *Document) Free()

func (*Document) ToJson

func (d *Document) ToJson(schema *Schema, includeFields ...string) (string, error)

type Index

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

func NewIndexWithSchema

func NewIndexWithSchema(path string, schema *Schema) (*Index, error)

func (*Index) AddAndConsumeDocuments

func (i *Index) AddAndConsumeDocuments(docs ...*Document) error

func (*Index) DeleteDocuments

func (i *Index) DeleteDocuments(field string, deleteIds ...string) error

func (*Index) Free

func (i *Index) Free()

func (*Index) NumDocs

func (i *Index) NumDocs() (uint64, error)

func (*Index) RegisterTextAnalyzerEdgeNgram

func (i *Index) RegisterTextAnalyzerEdgeNgram(tokenizerName string, minGram, maxGram uintptr, limit uintptr) error

func (*Index) RegisterTextAnalyzerNgram

func (i *Index) RegisterTextAnalyzerNgram(tokenizerName string, minGram, maxGram uintptr, prefixOnly bool) error

func (*Index) RegisterTextAnalyzerRaw

func (i *Index) RegisterTextAnalyzerRaw(tokenizerName string) error

func (*Index) RegisterTextAnalyzerSimple

func (i *Index) RegisterTextAnalyzerSimple(tokenizerName string, textLimit uintptr, lang string) error

func (*Index) Search

func (i *Index) Search(query string, docsLimit uintptr, withHighlights bool, fieldNames ...string) (*SearchResult, error)

type Schema

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

type SchemaBuilder

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

func NewSchemaBuilder

func NewSchemaBuilder() (*SchemaBuilder, error)

func (*SchemaBuilder) AddTextField

func (b *SchemaBuilder) AddTextField(
	name string,
	stored bool,
	isText bool,
	isFast bool,
	indexRecordOption int,
	tokenizer string,
) error

func (*SchemaBuilder) BuildSchema

func (b *SchemaBuilder) BuildSchema() (*Schema, error)

type SearchResult

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

func (*SearchResult) Free

func (r *SearchResult) Free()

func (*SearchResult) Get

func (r *SearchResult) Get(index uint64) (*Document, error)

func (*SearchResult) GetSize

func (r *SearchResult) GetSize() (uint64, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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