search

package
v0.0.0-...-9082c2d Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2016 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorDelegateNotFound = errors.New("delegate not found")
View Source
var Stemmers = map[string]func(string) string{
	"en": porter2.Stem,
}

Functions

func TextToStemmedWords

func TextToStemmedWords(lang, s string) []string

Types

type IndexData

type IndexData struct {
	Keyword   string
	Relevance float64
	Owner     string
}

func IndexDataFromText

func IndexDataFromText(lang, s string, relevance float64, owner string) []IndexData

Creates IndexData entries from a text.

TODO(tamasd): change the relevance parameter from float64 to some kind of a function.

type SearchPostData

type SearchPostData struct {
	Search string   `json:"search"`
	Owners []string `json:"owners"`
}

type SearchResult

type SearchResult struct {
	ab.Entity `json:"entity"`
	Type      string `json:"type"`
}

type SearchService

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

func NewSearchService

func NewSearchService(db ab.DB, cache SearchServiceCacheDelegate) *SearchService

func (*SearchService) AddDelegate

func (s *SearchService) AddDelegate(delegateType string, delegate SearchServiceDelegate) *SearchService

func (*SearchService) IndexEntity

func (s *SearchService) IndexEntity(entityType string, entity ab.Entity) error

func (*SearchService) PurgeIndex

func (s *SearchService) PurgeIndex() error

func (*SearchService) Register

func (s *SearchService) Register(srv *ab.Server) error

func (*SearchService) RemoveEntity

func (s *SearchService) RemoveEntity(uuid string) error

func (*SearchService) SchemaInstalled

func (s *SearchService) SchemaInstalled(db ab.DB) bool

func (*SearchService) SchemaSQL

func (s *SearchService) SchemaSQL() string

func (*SearchService) Search

func (s *SearchService) Search(search string, owners []string) ([]SearchResult, error)

type SearchServiceCacheDelegate

type SearchServiceCacheDelegate interface {
	Set(search string, results []SearchResult)
	Get(search string) []SearchResult
}

type SearchServiceDelegate

type SearchServiceDelegate interface {
	IndexEntity(ab.Entity) []IndexData
	LoadEntities([]string) []ab.Entity
}

Jump to

Keyboard shortcuts

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