textsearch

package
Version: v0.0.0-...-b178995 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package textsearch implements basic text search features (for matching text fields of JSON documents).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexedDoc

type IndexedDoc struct {
	Content string         `msgpack:"c"`
	Stems   map[string]int `msgpack:"s"`
}

IndexedDoc holds a parsed "document"

func NewIndexedDoc

func NewIndexedDoc(doc map[string]interface{}, fields []string) (*IndexedDoc, error)

NewIndexedDoc returns a parsed "document"

type SearchTerms

type SearchTerms []*searchTerm

SearchTerms holds a parsed text search query

func ParseTextQuery

func ParseTextQuery(q string) SearchTerms

ParseTextQuery returns a parsed text query

func (SearchTerms) Match

func (terms SearchTerms) Match(d *IndexedDoc) bool

Match returns true if the query matches the given `IndexedDoc`

Source Files

Jump to

Keyboard shortcuts

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