bleve

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package bleve fork from github.com/wangbin/jiebago and update bleve version

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JiebaTokenizerConstructor

func JiebaTokenizerConstructor(config map[string]interface{}, _ *registry.Cache) (analysis.Tokenizer, error)

JiebaTokenizerConstructor creates a JiebaTokenizer.

Parameter config should contains at least one parameter:

file: the path of the dictionary file.

hmm: optional, specify whether to use Hidden Markov Model, see NewJiebaTokenizer for details.

search: optional, speficy whether to use search mode, see NewJiebaTokenizer for details.

func NewJiebaTokenizer

func NewJiebaTokenizer(dictFilePath string, hmm, searchMode bool) (analysis.Tokenizer, error)

Types

type Bleve

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

func New

func New(options map[string]interface{}) (*Bleve, error)

func (*Bleve) Index

func (b *Bleve) Index(items []*search.Item) error

func (*Bleve) Search

func (b *Bleve) Search(query string, options *search.Options) []*search.Result

type JiebaTokenizer

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

JiebaTokenizer is the beleve tokenizer for jiebago.

func (*JiebaTokenizer) Tokenize

func (jt *JiebaTokenizer) Tokenize(input []byte) analysis.TokenStream

Tokenize cuts input into bleve token stream.

type Options

type Options struct {
	Path string `mapstructure:"path" default:"index"`
	Dict string `mapstructure:"dict" validate:"file" default:"config/dict.txt"`
}

Jump to

Keyboard shortcuts

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