Documentation
¶
Overview ¶
Package redisearch provides a Go client for the RediSearch search engine.
For the full documentation of RediSearch, see [http://redisearch.io](http://redisearch.io)
Example Usage ¶
```go
import ( "github.com/RediSearch/redisearch-go/redisearch" "log" "fmt" ) func ExampleClient() { // Create a client. By default a client is schemaless // unless a schema is provided when creating the index c := createClient("myIndex") // Create a schema sc := redisearch.NewSchema(redisearch.DefaultOptions). AddField(redisearch.NewTextField("body")). AddField(redisearch.NewTextFieldOptions("title", redisearch.TextFieldOptions{Weight: 5.0, Sortable: true})). AddField(redisearch.NewNumericField("date")) // Drop an existing index. If the index does not exist an error is returned c.Drop() // Create the index with the given schema if err := c.CreateIndex(sc); err != nil { log.Fatal(err) } // Create a document with an id and given score doc := redisearch.NewDocument("doc1", 1.0) doc.Set("title", "Hello world"). Set("body", "foo bar"). Set("date", time.Now().Unix()) // Index the document. The API accepts multiple documents at a time if err := c.IndexOptions(redisearch.DefaultIndexingOptions, doc); err != nil { log.Fatal(err) } // Searching with limit and sorting docs, total, err := c.Search(redisearch.NewQuery("hello world"). Limit(0, 2). SetReturnFields("title")) fmt.Println(docs[0].Id, docs[0].Properties["title"], total, err) // Output: doc1 Hello world 1 <nil> }
```
Index ¶
- Constants
- Variables
- func EscapeTextFileString(value string) string
- func ProcessAggResponse(res []interface{}) [][]string
- func ProcessAggResponseSS(res []interface{}) [][]string
- type AggregateQuery
- func (a *AggregateQuery) Apply(expression Projection) *AggregateQuery
- func (a *AggregateQuery) CursorHasResults() (res bool)
- func (a *AggregateQuery) Filter(expression string) *AggregateQuery
- func (a *AggregateQuery) GroupBy(group GroupBy) *AggregateQuery
- func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery
- func (q AggregateQuery) Serialize() redis.Args
- func (a *AggregateQuery) SetCursor(cursor *Cursor) *AggregateQuery
- func (a *AggregateQuery) SetMax(value int) *AggregateQuery
- func (a *AggregateQuery) SetQuery(query *Query) *AggregateQuery
- func (a *AggregateQuery) SetVerbatim(value bool) *AggregateQuery
- func (a *AggregateQuery) SetWithSchema(value bool) *AggregateQuery
- func (a *AggregateQuery) SortBy(SortByProperties []SortingKey) *AggregateQuery
- type Autocompleter
- type Client
- func (i *Client) Aggregate(q *AggregateQuery) (aggregateReply [][]string, total int, err error)
- func (i *Client) CreateIndex(s *Schema) error
- func (i *Client) Delete(docId string, deleteDocument bool) (err error)
- func (i *Client) Drop() error
- func (i *Client) Explain(q *Query) (string, error)
- func (i *Client) Index(docs ...Document) error
- func (i *Client) IndexOptions(opts IndexingOptions, docs ...Document) error
- func (i *Client) Info() (*IndexInfo, error)
- func (i *Client) Search(q *Query) (docs []Document, total int, err error)
- func (i *Client) SpellCheck(q *Query, s *SpellCheckOptions) (suggs []MisspelledTerm, total int, err error)
- type ConnPool
- type Cursor
- type Document
- type DocumentList
- type Field
- func NewNumericField(name string) Field
- func NewNumericFieldOptions(name string, options NumericFieldOptions) Field
- func NewSortableNumericField(name string) Field
- func NewSortableTextField(name string, weight float32) Field
- func NewTagField(name string) Field
- func NewTagFieldOptions(name string, opts TagFieldOptions) Field
- func NewTextField(name string) Field
- func NewTextFieldOptions(name string, opts TextFieldOptions) Field
- type FieldType
- type Flag
- type GroupBy
- type GroupByReducers
- type HighlightOptions
- type IndexInfo
- type IndexingOptions
- type MisspelledSuggestion
- type MisspelledTerm
- type MultiError
- type MultiHostPool
- type NumericFieldOptions
- type Operator
- type Options
- type Paging
- type Predicate
- func Equals(property string, value interface{}) Predicate
- func GreaterThan(property string, value interface{}) Predicate
- func GreaterThanEquals(property string, value interface{}) Predicate
- func InRange(property string, min, max interface{}, inclusive bool) Predicate
- func LessThan(property string, value interface{}) Predicate
- func LessThanEquals(property string, value interface{}) Predicate
- func NewPredicate(property string, operator Operator, values ...interface{}) Predicate
- type Projection
- type Query
- func (q *Query) Highlight(fields []string, openTag, closeTag string) *Query
- func (q *Query) Limit(offset, num int) *Query
- func (q *Query) SetExpander(exp string) *Query
- func (q *Query) SetFlags(flags Flag) *Query
- func (q *Query) SetInKeys(keys ...string) *Query
- func (q *Query) SetLanguage(lang string) *Query
- func (q *Query) SetPayload(payload []byte) *Query
- func (q *Query) SetReturnFields(fields ...string) *Query
- func (q *Query) SetScorer(scorer string) *Query
- func (q *Query) SetSortBy(field string, ascending bool) *Query
- func (q *Query) Summarize(fields ...string) *Query
- func (q *Query) SummarizeOptions(opts SummaryOptions) *Query
- type Reducer
- type Schema
- type SingleHostPool
- type SortingKey
- type SpellCheckOptions
- type SuggestOptions
- type Suggestion
- type SuggestionList
- type SummaryOptions
- type TagFieldOptions
- type TextFieldOptions
Examples ¶
Constants ¶
const ( // GroupByReducerCount is an alias for GROUPBY reducer COUNT GroupByReducerCount = GroupByReducers("COUNT") // GroupByReducerCountDistinct is an alias for GROUPBY reducer COUNT_DISTINCT GroupByReducerCountDistinct = GroupByReducers("COUNT_DISTINCT") // GroupByReducerCountDistinctish is an alias for GROUPBY reducer COUNT_DISTINCTISH GroupByReducerCountDistinctish = GroupByReducers("COUNT_DISTINCTISH") // GroupByReducerSum is an alias for GROUPBY reducer SUM GroupByReducerSum = GroupByReducers("SUM") // GroupByReducerMin is an alias for GROUPBY reducer MIN GroupByReducerMin = GroupByReducers("MIN") // GroupByReducerMax is an alias for GROUPBY reducer MAX GroupByReducerMax = GroupByReducers("MAX") // GroupByReducerAvg is an alias for GROUPBY reducer AVG GroupByReducerAvg = GroupByReducers("AVG") // GroupByReducerStdDev is an alias for GROUPBY reducer STDDEV GroupByReducerStdDev = GroupByReducers("STDDEV") // GroupByReducerQuantile is an alias for GROUPBY reducer QUANTILE GroupByReducerQuantile = GroupByReducers("QUANTILE") // GroupByReducerToList is an alias for GROUPBY reducer TOLIST GroupByReducerToList = GroupByReducers("TOLIST") // GroupByReducerFirstValue is an alias for GROUPBY reducer FIRST_VALUE GroupByReducerFirstValue = GroupByReducers("FIRST_VALUE") // GroupByReducerRandomSample is an alias for GROUPBY reducer RANDOM_SAMPLE GroupByReducerRandomSample = GroupByReducers("RANDOM_SAMPLE") )
Variables ¶
var DefaultIndexingOptions = IndexingOptions{ Language: "", NoSave: false, Replace: false, Partial: false, }
DefaultIndexingOptions are the default options for document indexing
var DefaultOptions = Options{ NoSave: false, NoFieldFlags: false, NoFrequencies: false, NoOffsetVectors: false, Stopwords: nil, }
DefaultOptions represents the default options
Functions ¶
func EscapeTextFileString ¶ added in v0.2.0
All punctuation marks and whitespaces (besides underscores) separate the document and queries into tokens. e.g. any character of `,.<>{}[]"':;!@#$%^&*()-+=~` will break the text into terms. So the text `foo-bar.baz...bag` will be tokenized into `[foo, bar, baz, bag]` Escaping separators in both queries and documents is done by prepending a backslash to any separator. e.g. the text `hello\-world hello-world` will be tokenized as `[hello-world, hello, world]`. **NOTE** that in most languages you will need an extra backslash when formatting the document or query, to signify an actual backslash, so the actual text in redis-cli for example, will be entered as `hello\\-world`. Underscores (`_`) are not used as separators in either document or query. So the text `hello_world` will remain as is after tokenization.
func ProcessAggResponse ¶ added in v0.2.0
func ProcessAggResponse(res []interface{}) [][]string
func ProcessAggResponseSS ¶ added in v0.2.0
func ProcessAggResponseSS(res []interface{}) [][]string
Types ¶
type AggregateQuery ¶ added in v0.2.0
type AggregateQuery struct { Query *Query AggregatePlan redis.Args Paging *Paging Max int WithSchema bool Verbatim bool // TODO: add cursor WithCursor bool Cursor *Cursor }
AggregateQuery
func NewAggregateQuery ¶ added in v0.2.0
func NewAggregateQuery() *AggregateQuery
func (*AggregateQuery) Apply ¶ added in v0.2.0
func (a *AggregateQuery) Apply(expression Projection) *AggregateQuery
Adds a APPLY clause to the aggregate plan
func (*AggregateQuery) CursorHasResults ¶ added in v0.2.0
func (a *AggregateQuery) CursorHasResults() (res bool)
func (*AggregateQuery) Filter ¶ added in v0.2.0
func (a *AggregateQuery) Filter(expression string) *AggregateQuery
Specify filters to filter the results using predicates relating to values in the result set.
func (*AggregateQuery) GroupBy ¶ added in v0.2.0
func (a *AggregateQuery) GroupBy(group GroupBy) *AggregateQuery
Adds a GROUPBY clause to the aggregate plan
func (*AggregateQuery) Limit ¶ added in v0.2.0
func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery
Sets the limit for the initial pool of results from the query.
func (AggregateQuery) Serialize ¶ added in v0.2.0
func (q AggregateQuery) Serialize() redis.Args
func (*AggregateQuery) SetCursor ¶ added in v0.2.0
func (a *AggregateQuery) SetCursor(cursor *Cursor) *AggregateQuery
func (*AggregateQuery) SetMax ¶ added in v0.2.0
func (a *AggregateQuery) SetMax(value int) *AggregateQuery
func (*AggregateQuery) SetQuery ¶ added in v0.2.0
func (a *AggregateQuery) SetQuery(query *Query) *AggregateQuery
func (*AggregateQuery) SetVerbatim ¶ added in v0.2.0
func (a *AggregateQuery) SetVerbatim(value bool) *AggregateQuery
func (*AggregateQuery) SetWithSchema ¶ added in v0.2.0
func (a *AggregateQuery) SetWithSchema(value bool) *AggregateQuery
func (*AggregateQuery) SortBy ¶ added in v0.2.0
func (a *AggregateQuery) SortBy(SortByProperties []SortingKey) *AggregateQuery
Adds a SORTBY clause to the aggregate plan
type Autocompleter ¶
type Autocompleter struct {
// contains filtered or unexported fields
}
Autocompleter implements a redisearch auto-completer API
func NewAutocompleter ¶
func NewAutocompleter(addr, name string) *Autocompleter
NewAutocompleter creates a new Autocompleter with the given host and key name
func (*Autocompleter) AddTerms ¶
func (a *Autocompleter) AddTerms(terms ...Suggestion) error
AddTerms pushes new term suggestions to the index
func (*Autocompleter) Delete ¶
func (a *Autocompleter) Delete() error
Delete deletes the Autocompleter key for this AC
func (*Autocompleter) Suggest
deprecated
func (a *Autocompleter) Suggest(prefix string, num int, fuzzy bool) ([]Suggestion, error)
Suggest gets completion suggestions from the Autocompleter dictionary to the given prefix. If fuzzy is set, we also complete for prefixes that are in 1 Levenshten distance from the given prefix
Deprecated: Please use SuggestOpts() instead
func (*Autocompleter) SuggestOpts ¶
func (a *Autocompleter) SuggestOpts(prefix string, opts SuggestOptions) ([]Suggestion, error)
SuggestOpts gets completion suggestions from the Autocompleter dictionary to the given prefix. SuggestOptions are passed allowing you specify if the returned values contain a payload, and scores. If SuggestOptions.Fuzzy is set, we also complete for prefixes that are in 1 Levenshten distance from the given prefix
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an interface to redisearch's redis commands
Example ¶
package main import ( "fmt" "log" "os" "time" "github.com/RediSearch/redisearch-go/redisearch" ) func createClient(indexName string) *redisearch.Client { value, exists := os.LookupEnv("REDISEARCH_TEST_HOST") host := "localhost:6379" if exists && value != "" { host = value } return redisearch.NewClient(host, indexName) } func main() { // Create a client. By default a client is schemaless // unless a schema is provided when creating the index c := createClient("myIndex") // Create a schema sc := redisearch.NewSchema(redisearch.DefaultOptions). AddField(redisearch.NewTextField("body")). AddField(redisearch.NewTextFieldOptions("title", redisearch.TextFieldOptions{Weight: 5.0, Sortable: true})). AddField(redisearch.NewNumericField("date")) // Drop an existing index. If the index does not exist an error is returned c.Drop() // Create the index with the given schema if err := c.CreateIndex(sc); err != nil { log.Fatal(err) } // Create a document with an id and given score doc := redisearch.NewDocument("doc1", 1.0) doc.Set("title", "Hello world"). Set("body", "foo bar"). Set("date", time.Now().Unix()) // Index the document. The API accepts multiple documents at a time if err := c.IndexOptions(redisearch.DefaultIndexingOptions, doc); err != nil { log.Fatal(err) } // Searching with limit and sorting docs, total, err := c.Search(redisearch.NewQuery("hello world"). Limit(0, 2). SetReturnFields("title")) fmt.Println(docs[0].Id, docs[0].Properties["title"], total, err) }
Output: doc1 Hello world 1 <nil>
func NewClient ¶
NewClient creates a new client connecting to the redis host, and using the given name as key prefix. Addr can be a single host:port pair, or a comma separated list of host:port,host:port... In the case of multiple hosts we create a multi-pool and select connections at random
func (*Client) Aggregate ¶ added in v0.2.0
func (i *Client) Aggregate(q *AggregateQuery) (aggregateReply [][]string, total int, err error)
Aggregate
func (*Client) CreateIndex ¶
CreateIndex configues the index and creates it on redis
func (*Client) Delete ¶ added in v0.2.0
Delete the document from the index, optionally delete the actual document
func (*Client) Drop ¶
Drop the Currentl just flushes the DB - note that this will delete EVERYTHING on the redis instance
func (*Client) IndexOptions ¶
func (i *Client) IndexOptions(opts IndexingOptions, docs ...Document) error
IndexOptions indexes multiple documents on the index, with optional Options passed to options
func (*Client) Info ¶
Info - Get information about the index. This can also be used to check if the index exists
func (*Client) Search ¶
Search searches the index for the given query, and returns documents, the total number of results, or an error if something went wrong
func (*Client) SpellCheck ¶ added in v0.2.0
func (i *Client) SpellCheck(q *Query, s *SpellCheckOptions) (suggs []MisspelledTerm, total int, err error)
SpellCheck performs spelling correction on a query, returning suggestions for misspelled terms, the total number of results, or an error if something went wrong
type Document ¶
Document represents a single document to be indexed or returned from a query. Besides a score and id, the Properties are completely arbitrary
func NewDocument ¶
NewDocument creates a document with the specific id and score
func (*Document) EstimateSize ¶
func (*Document) SetPayload ¶
SetPayload Sets the document payload
type DocumentList ¶
type DocumentList []Document
DocumentList is used to sort documents by descending score
func (DocumentList) Len ¶
func (l DocumentList) Len() int
func (DocumentList) Less ¶
func (l DocumentList) Less(i, j int) bool
func (DocumentList) Swap ¶
func (l DocumentList) Swap(i, j int)
type Field ¶
Field represents a single field's Schema
func NewNumericField ¶
NewNumericField creates a new numeric field with the given name
func NewNumericFieldOptions ¶
func NewNumericFieldOptions(name string, options NumericFieldOptions) Field
NewNumericFieldOptions defines a numeric field with additional options
func NewSortableNumericField ¶
NewSortableNumericField creates a new numeric field with the given name and a sortable flag
func NewSortableTextField ¶
NewSortableTextField creates a text field with the sortable flag set
func NewTagField ¶
NewTagField creates a new text field with default options (separator: ,)
func NewTagFieldOptions ¶
func NewTagFieldOptions(name string, opts TagFieldOptions) Field
NewTagFieldOptions creates a new tag field with the given options
func NewTextField ¶
NewTextField creates a new text field with the given weight
func NewTextFieldOptions ¶
func NewTextFieldOptions(name string, opts TextFieldOptions) Field
NewTextFieldOptions creates a new text field with given options (weight/sortable)
type Flag ¶
type Flag uint64
Flag is a type for query flags
const ( // Treat the terms verbatim and do not perform expansion QueryVerbatim Flag = 0x1 // Do not load any content from the documents, return just IDs QueryNoContent Flag = 0x2 // Fetch document scores as well as IDs and fields QueryWithScores Flag = 0x4 // The query terms must appear in order in the document QueryInOrder Flag = 0x08 // Fetch document payloads as well as fields. See documentation for payloads on redisearch.io QueryWithPayloads Flag = 0x10 DefaultOffset = 0 DefaultNum = 10 )
Query Flags
type GroupBy ¶ added in v0.2.0
GroupBy
func NewGroupBy ¶ added in v0.2.0
func NewGroupBy() *GroupBy
type HighlightOptions ¶
HighlightOptions represents the options to higlight specific document fields. See http://redisearch.io/Highlight/
type IndexInfo ¶
type IndexInfo struct { Schema Schema Name string `redis:"index_name"` DocCount uint64 `redis:"num_docs"` RecordCount uint64 `redis:"num_records"` TermCount uint64 `redis:"num_terms"` MaxDocID uint64 `redis:"max_doc_id"` InvertedIndexSizeMB float64 `redis:"inverted_sz_mb"` OffsetVectorSizeMB float64 `redis:"offset_vector_sz_mb"` DocTableSizeMB float64 `redis:"doc_table_size_mb"` KeyTableSizeMB float64 `redis:"key_table_size_mb"` RecordsPerDocAvg float64 `redis:"records_per_doc_avg"` BytesPerRecordAvg float64 `redis:"bytes_per_record_avg"` OffsetsPerTermAvg float64 `redis:"offsets_per_term_avg"` OffsetBitsPerTermAvg float64 `redis:"offset_bits_per_record_avg"` }
IndexInfo - Structure showing information about an existing index
type IndexingOptions ¶
IndexingOptions represent the options for indexing a single document
type MisspelledSuggestion ¶ added in v0.2.0
MisspelledSuggestion is a single suggestion from the spelling corrections
func NewMisspelledSuggestion ¶ added in v0.2.0
func NewMisspelledSuggestion(term string, score float32) MisspelledSuggestion
NewMisspelledSuggestion creates a MisspelledSuggestion with the specific term and score
type MisspelledTerm ¶ added in v0.2.0
type MisspelledTerm struct { Term string // MisspelledSuggestionList is a sortable list of suggestions returned from an engine MisspelledSuggestionList []MisspelledSuggestion }
MisspelledTerm contains the misspelled term and a sortable list of suggestions returned from an engine
func NewMisspelledTerm ¶ added in v0.2.0
func NewMisspelledTerm(term string) MisspelledTerm
func (MisspelledTerm) Len ¶ added in v0.2.0
func (l MisspelledTerm) Len() int
func (MisspelledTerm) Less ¶ added in v0.2.0
func (l MisspelledTerm) Less(i, j int) bool
func (MisspelledTerm) Swap ¶ added in v0.2.0
func (l MisspelledTerm) Swap(i, j int)
type MultiError ¶
type MultiError []error
MultiError Represents one or more errors
func NewMultiError ¶
func NewMultiError(len int) MultiError
NewMultiError initializes a multierror with the given len, and all sub-errors set to nil
func (MultiError) Error ¶
func (e MultiError) Error() string
Error returns a string representation of the error, in this case it just chains all the sub errors if they are not nil
type MultiHostPool ¶
func NewMultiHostPool ¶
func NewMultiHostPool(hosts []string) *MultiHostPool
func (*MultiHostPool) Get ¶
func (p *MultiHostPool) Get() redis.Conn
type NumericFieldOptions ¶
NumericFieldOptions Options for numeric fields
type Options ¶
type Options struct { // If set, we will not save the documents contents, just index them, for fetching ids only NoSave bool NoFieldFlags bool NoFrequencies bool NoOffsetVectors bool Stopwords []string }
Options are flags passed to the the abstract Index call, which receives them as interface{}, allowing for implementation specific options
type Predicate ¶
func GreaterThan ¶
func GreaterThanEquals ¶
func LessThanEquals ¶
func NewPredicate ¶
type Projection ¶ added in v0.2.0
Projection
func NewProjection ¶ added in v0.2.0
func NewProjection(expression string, alias string) *Projection
func (Projection) Serialize ¶ added in v0.2.0
func (p Projection) Serialize() redis.Args
type Query ¶
type Query struct { Raw string Paging Paging Flags Flag Slop int Filters []Predicate InKeys []string ReturnFields []string Language string Expander string Scorer string Payload []byte SortBy *SortingKey HighlightOpts *HighlightOptions SummarizeOpts *SummaryOptions }
Query is a single search query and all its parameters and predicates
func NewQuery ¶
NewQuery creates a new query for a given index with the given search term. For currently the index parameter is ignored
func (*Query) Highlight ¶
Highlight sets highighting on given fields. Highlighting marks all the query terms with the given open and close tags (i.e. <b> and </b> for HTML)
func (*Query) Limit ¶
Limit sets the paging offset and limit for the query you can use LIMIT 0 0 to count the number of documents in the resultset without actually returning them
func (*Query) SetExpander ¶
SetExpander sets a custom user query expander to be used
func (*Query) SetInKeys ¶
SetInKeys sets the INKEYS argument of the query - limiting the search to a given set of IDs
func (*Query) SetLanguage ¶
SetLanguage sets the query language, used by the stemmer to expand the query
func (*Query) SetPayload ¶
SetPayload sets a binary payload to the query, that can be used by custom scoring functions
func (*Query) SetReturnFields ¶
SetReturnFields sets the fields that should be returned from each result. By default we return everything
func (*Query) SetScorer ¶
SetScorer sets an alternative scoring function to be used. The only pre-compiled supported one at the moment is DISMAX
func (*Query) Summarize ¶
Summarize sets summarization on the given list of fields. It will instruct the engine to extract the most relevant snippets from the fields and return them as the field content. This function works with the default values of the engine, and only sets the fields. There is a function that accepts all options - SummarizeOptions
func (*Query) SummarizeOptions ¶
func (q *Query) SummarizeOptions(opts SummaryOptions) *Query
SummarizeOptions sets summarization on the given list of fields. It will instruct the engine to extract the most relevant snippets from the fields and return them as the field content.
This function accepts advanced settings for snippet length, separators and number of snippets
type Reducer ¶ added in v0.2.0
type Reducer struct { Name GroupByReducers Alias string Args []string }
Reducer represents an index schema Schema, or how the index would treat documents sent to it.
func NewReducer ¶ added in v0.2.0
func NewReducer(name GroupByReducers, args []string) *Reducer
NewReducer creates a new Reducer object
func NewReducerAlias ¶ added in v0.2.0
func NewReducerAlias(name GroupByReducers, args []string, alias string) *Reducer
NewReducer creates a new Reducer object
func (*Reducer) SetName ¶ added in v0.2.0
func (r *Reducer) SetName(reducer GroupByReducers) *Reducer
type Schema ¶
Schema represents an index schema Schema, or how the index would treat documents sent to it.
type SingleHostPool ¶
func NewSingleHostPool ¶
func NewSingleHostPool(host string) *SingleHostPool
type SortingKey ¶
SortingKey represents the sorting option if the query needs to be sorted based on a sortable fields and not a ranking function. See http://redisearch.io/Sorting/
func NewSortingKeyDir ¶ added in v0.2.0
func NewSortingKeyDir(field string, ascending bool) *SortingKey
func (SortingKey) Serialize ¶ added in v0.2.0
func (s SortingKey) Serialize() redis.Args
type SpellCheckOptions ¶ added in v0.2.0
SpellCheckOptions are options which are passed when performing spelling correction on a query
func NewSpellCheckOptions ¶ added in v0.2.0
func NewSpellCheckOptions(distance int) *SpellCheckOptions
func NewSpellCheckOptionsDefaults ¶ added in v0.2.0
func NewSpellCheckOptionsDefaults() *SpellCheckOptions
func (*SpellCheckOptions) AddExclusionDict ¶ added in v0.2.0
func (s *SpellCheckOptions) AddExclusionDict(dictname string) *SpellCheckOptions
AddExclusionDict adds a custom dictionary named {dictname} to the exclusion list
func (*SpellCheckOptions) AddInclusionDict ¶ added in v0.2.0
func (s *SpellCheckOptions) AddInclusionDict(dictname string) *SpellCheckOptions
AddInclusionDict adds a custom dictionary named {dictname} to the inclusion list
func (*SpellCheckOptions) SetDistance ¶ added in v0.2.0
func (s *SpellCheckOptions) SetDistance(distance int) (*SpellCheckOptions, error)
SetDistance Sets the the maximal Levenshtein distance for spelling suggestions (default: 1, max: 4)
type SuggestOptions ¶
SuggestOptions are options which are passed when recieving suggestions from the Autocompleter
type Suggestion ¶
Suggestion is a single suggestion being added or received from the Autocompleter
type SuggestionList ¶
type SuggestionList []Suggestion
SuggestionList is a sortable list of suggestions returned from an engine
func (SuggestionList) Len ¶
func (l SuggestionList) Len() int
func (SuggestionList) Less ¶
func (l SuggestionList) Less(i, j int) bool
func (SuggestionList) Swap ¶
func (l SuggestionList) Swap(i, j int)
type SummaryOptions ¶
type SummaryOptions struct { Fields []string FragmentLen int // default 20 NumFragments int // default 3 Separator string // default "..." }
SummaryOptions represents the configuration used to create field summaries. See http://redisearch.io/Highlight/
type TagFieldOptions ¶
type TagFieldOptions struct { // Separator is the custom separator between tags. defaults to comma (,) Separator byte NoIndex bool Sortable bool }
TagFieldOptions options for indexing tag fields