Documentation
¶
Overview ¶
Example ¶
package main import ( "context" "fmt" "github.com/blugelabs/bluge" "github.com/blugelabs/sour" ) func main() { s := sour.New(bluge.InMemoryOnlyConfig()) s.Reset(bluge.NewDocument("id"). AddField(bluge.NewKeywordField("name", "sour"))) dmi, err := s.Search(context.Background(), bluge.NewTopNSearch(0, bluge.NewTermQuery("sour").SetField("name")). WithStandardAggregations()) if err != nil { panic(err) } if dmi.Aggregations().Count() > 0 { fmt.Println("matches name sour") } else { fmt.Println("does not match name sour") } }
Output: matches name sour
Index ¶
- type CollectionStats
- type DictEntry
- type Dictionary
- type DictionaryIterator
- type DocValueReader
- type Location
- type Posting
- type Sour
- func (s *Sour) Close() error
- func (s *Sour) CollectionStats(field string) (segment.CollectionStats, error)
- func (s *Sour) DictionaryIterator(field string, automaton segment.Automaton, start, end []byte) (segment.DictionaryIterator, error)
- func (s *Sour) DictionaryLookup(field string) (segment.DictionaryLookup, error)
- func (s *Sour) DocumentValueReader(fields []string) (segment.DocumentValueReader, error)
- func (s *Sour) Fields() []string
- func (s *Sour) PostingsIterator(term []byte, field string, includeFreq, includeNorm, includeTermVectors bool) (segment.PostingsIterator, error)
- func (s *Sour) Reset(doc *bluge.Document)
- func (s *Sour) Search(ctx context.Context, req bluge.SearchRequest) (search.DocumentMatchIterator, error)
- func (s *Sour) SortedTermsForField(fieldName string) ([]string, error)
- func (s *Sour) TokenFreqsAndLen(fieldName string) (analysis.TokenFrequencies, int, error)
- func (s *Sour) VisitStoredFields(number uint64, visitor segment.StoredFieldVisitor) error
- type TermFieldReader
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectionStats ¶
type CollectionStats struct{}
func (*CollectionStats) DocumentCount ¶
func (c *CollectionStats) DocumentCount() uint64
DocumentCount returns the number of documents with at least one term for this field
func (*CollectionStats) Merge ¶
func (c *CollectionStats) Merge(segment.CollectionStats)
func (*CollectionStats) SumTotalTermFrequency ¶
func (c *CollectionStats) SumTotalTermFrequency() uint64
SumTotalTermFrequency returns to total number of tokens across all documents
func (*CollectionStats) TotalDocumentCount ¶
func (c *CollectionStats) TotalDocumentCount() uint64
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
func (*Dictionary) Close ¶
func (d *Dictionary) Close() error
type DictionaryIterator ¶
type DictionaryIterator struct {
// contains filtered or unexported fields
}
func NewDictionaryIteratorWithTerms ¶
func NewDictionaryIteratorWithTerms(terms []string, include func(string) bool) *DictionaryIterator
func NewFieldDictEmpty ¶
func NewFieldDictEmpty() *DictionaryIterator
func (*DictionaryIterator) Close ¶
func (d *DictionaryIterator) Close() error
func (*DictionaryIterator) Next ¶
func (d *DictionaryIterator) Next() (segment.DictionaryEntry, error)
type DocValueReader ¶
type DocValueReader struct {
// contains filtered or unexported fields
}
func (*DocValueReader) VisitDocumentValues ¶
func (d *DocValueReader) VisitDocumentValues(number uint64, visitor segment.DocumentValueVisitor) error
type Sour ¶
type Sour struct {
// contains filtered or unexported fields
}
func (*Sour) CollectionStats ¶
func (s *Sour) CollectionStats(field string) (segment.CollectionStats, error)
func (*Sour) DictionaryIterator ¶
func (s *Sour) DictionaryIterator(field string, automaton segment.Automaton, start, end []byte) (segment.DictionaryIterator, error)
DictionaryIterator provides a way to explore the terms used in the specified field. You can optionally filter these terms by the provided Automaton, or start/end terms.
func (*Sour) DictionaryLookup ¶
func (s *Sour) DictionaryLookup(field string) (segment.DictionaryLookup, error)
func (*Sour) DocumentValueReader ¶
func (s *Sour) DocumentValueReader(fields []string) (segment.DocumentValueReader, error)
func (*Sour) PostingsIterator ¶
func (s *Sour) PostingsIterator(term []byte, field string, includeFreq, includeNorm, includeTermVectors bool) (segment.PostingsIterator, error)
PostingsIterator provides a way to find information about all documents that use the specified term in the specified field.
func (*Sour) Search ¶
func (s *Sour) Search(ctx context.Context, req bluge.SearchRequest) (search.DocumentMatchIterator, error)
func (*Sour) SortedTermsForField ¶
func (*Sour) TokenFreqsAndLen ¶
func (*Sour) VisitStoredFields ¶
func (s *Sour) VisitStoredFields(number uint64, visitor segment.StoredFieldVisitor) error
type TermFieldReader ¶
type TermFieldReader struct {
// contains filtered or unexported fields
}
func NewTermFieldReaderEmpty ¶
func NewTermFieldReaderEmpty() *TermFieldReader
func NewTermFieldReaderFromTokenFreqAndLen ¶
func NewTermFieldReaderFromTokenFreqAndLen(tf *analysis.TokenFreq, l int, includeFreq, includeNorm, includeTermVectors bool) *TermFieldReader
func (*TermFieldReader) Advance ¶
func (t *TermFieldReader) Advance(docNum uint64) (segment.Posting, error)
Advance resets the enumeration at specified document or its immediate follower.
func (*TermFieldReader) Close ¶
func (t *TermFieldReader) Close() error
func (*TermFieldReader) Count ¶
func (t *TermFieldReader) Count() uint64
func (*TermFieldReader) Empty ¶
func (t *TermFieldReader) Empty() bool
func (*TermFieldReader) Size ¶
func (t *TermFieldReader) Size() int
Click to show internal directories.
Click to hide internal directories.