gomate

package module
v0.0.0-...-3eb4064 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

README

GoMate

Build Status Go Report Card Coverage

Implementation of Soulmate's full-text search algorithm in Go, using LedisDB backend. It can be adapted to use Redis (or any Redis-like system), by implementing the DB interface.

For an introduction to the algorithm, read this.

I wrote this package as a quick search implementation for GoSonic, but I decided to publish it as an independent, reusable library.

Watch this space for documentation and examples.

Documentation

Index

Constants

View Source
const (
	AggregateSum byte = 0
	AggregateMin byte = 1
	AggregateMax byte = 2
)
View Source
const (
	DefaultNamespace = "gomate-index"
	IdSetSuffix      = "all-ids"
	KeyChainSuffix   = "all-keys"
)
View Source
const (
	KindSet  = "S-"
	KindZSet = "Z-"
	KindHash = "H-"
)
View Source
const CacheTimeOut = 600

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Zadd(key string, pairs ...ScorePair) error
	Zrem(key string, members ...string) error
	Zrange(key string, start int, stop int) ([]ScorePair, error)
	Zinterstore(destKey string, srcKeys []string, aggregate byte) (int64, error)
	Zclear(key string) (int64, error)
	Zkeyexists(key string) (bool, error)
	Zexpire(key string, duration int64) (int64, error)
	Sadd(key string, member ...string) (int64, error)
	Smembers(key string) ([]string, error)
	Sclear(key string) (int64, error)
	Hset(key, field, value string) (int64, error)
	Hmget(key string, fields ...string) ([]string, error)
	Hclear(key string) (int64, error)
}

type Indexer

type Indexer interface {
	Index(id string, doc string) error
	Remove(ids ...string) error
	Clear() error
}

func NewIndexer

func NewIndexer(db DB, namespace ...string) Indexer

type ScorePair

type ScorePair struct {
	Score  int64
	Member string
}

type Searcher

type Searcher interface {
	Search(query string, min int, max int) ([]string, error)
}

func NewSearcher

func NewSearcher(db DB, namespace ...string) Searcher

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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