# README
Bluge
modern text indexing in go - blugelabs.com
Features
- Supported field types:
- Text, Numeric, Date, Geo Point
- Supported query types:
- Term, Phrase, Match, Match Phrase, Prefix
- Conjunction, Disjunction, Boolean
- Numeric Range, Date Range
- BM25 Similarity/Scoring with pluggable interfaces
- Search result match highlighting
- Extendable Aggregations:
- Bucketing
- Terms
- Numeric Range
- Date Range
- Metrics
- Min/Max/Count/Sum
- Avg/Weighted Avg
- Cardinality Estimation (HyperLogLog++)
- Quantile Approximation (T-Digest)
- Bucketing
Indexing
config := bluge.DefaultConfig(path)
writer, err := bluge.OpenWriter(config)
if err != nil {
log.Fatalf("error opening writer: %v", err)
}
defer writer.Close()
doc := bluge.NewDocument("example").
AddField(bluge.NewTextField("name", "bluge"))
err = writer.Update(doc.ID(), doc)
if err != nil {
log.Fatalf("error updating document: %v", err)
}
Querying
reader, err := writer.Reader()
if err != nil {
log.Fatalf("error getting index reader: %v", err)
}
defer reader.Close()
query := bluge.NewMatchQuery("bluge").SetField("name")
request := bluge.NewTopNSearch(10, query).
WithStandardAggregations()
documentMatchIterator, err := reader.Search(context.Background(), request)
if err != nil {
log.Fatalf("error executing search: %v", err)
}
match, err := documentMatchIterator.Next()
for err == nil && match != nil {
err = match.VisitStoredFields(func(field string, value []byte) bool {
if field == "_id" {
fmt.Printf("match: %s\n", string(value))
}
return true
})
if err != nil {
log.Fatalf("error loading stored fields: %v", err)
}
match, err = documentMatchIterator.Next()
}
if err != nil {
log.Fatalf("error iterator document matches: %v", err)
}
Repobeats
License
Apache License Version 2.0
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewBatch creates a new empty batch.
NewBooleanQuery creates a compound Query composed of several other Query objects.
No description provided by the author
No description provided by the author
No description provided by the author
NewDateRangeInclusiveQuery creates a new Query for ranges of date values.
NewDateRangeQuery creates a new Query for ranges of date values.
No description provided by the author
No description provided by the author
No description provided by the author
NewFuzzyQuery creates a new Query which finds documents containing terms within a specific fuzziness of the specified term.
NewGeoBoundingBoxQuery creates a new Query for performing geo bounding box searches.
FIXME document like the others.
NewGeoDistanceQuery creates a new Query for performing geo distance searches.
No description provided by the author
No description provided by the author
No description provided by the author
NewMatchAllQuery creates a Query which will match all documents in the index.
NewMatchNoneQuery creates a Query which will not match any documents in the index.
NewMatchPhraseQuery creates a new Query object for matching phrases in the index.
NewMatchQuery creates a Query for matching text.
NewMultiPhraseQuery creates a new Query for finding term phrases in the index.
No description provided by the author
No description provided by the author
NewNumericRangeInclusiveQuery creates a new Query for ranges of numeric values.
NewNumericRangeQuery creates a new Query for ranges of numeric values.
NewPrefixQuery creates a new Query which finds documents containing terms that start with the specified prefix.
NewRegexpQuery creates a new Query which finds documents containing terms that match the specified regular expression.
No description provided by the author
NewTermQuery creates a new Query for finding an exact term match in the index.
NewTermRangeInclusiveQuery creates a new Query for ranges of text terms.
NewTermRangeQuery creates a new Query for ranges of text terms.
No description provided by the author
No description provided by the author
NewTopNSearch creates a search which will find the matches and return the first N when ordered by the specified sort order (default: score descending).
NewWildcardQuery creates a new Query which finds documents containing terms that match the specified wildcard.
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
Document must satisfy ALL of term searches.
Document must satisfy AT LEAST ONE of term searches.
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
TopNSearch is used to search for a fixed number of matches which can be sorted by a custom sort order.
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
No description provided by the author
FieldConsumer is anything which can consume a field Fields can implement this interface to consume the content of another field.
A Query represents a description of the type and parameters for a query into the index.
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author