search

package
v0.0.0-...-f1a3a7a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LevenshteinDistance

func LevenshteinDistance(a, b *string) int

func LevenshteinDistanceMax

func LevenshteinDistanceMax(a, b *string, max int) (int, bool)

levenshteinDistanceMax same as levenshteinDistance but attempts to bail early once we know the distance will be greater than max in which case the first return val will be the max and the second will be true, indicating max was exceeded

Types

type Collector

type Collector interface {
	Collect(searcher Searcher) error
	Results() DocumentMatchCollection
	Total() uint64
	MaxScore() float64
	Took() time.Duration
	SetFacetsBuilder(facetsBuilder *FacetsBuilder)
	FacetResults() FacetResults
}

type DateRangeFacet

type DateRangeFacet struct {
	Name  string  `json:"name"`
	Start *string `json:"start,omitempty"`
	End   *string `json:"end,omitempty"`
	Count int     `json:"count"`
}

func (*DateRangeFacet) Same

func (drf *DateRangeFacet) Same(other *DateRangeFacet) bool

type DateRangeFacets

type DateRangeFacets []*DateRangeFacet

func (DateRangeFacets) Add

func (drf DateRangeFacets) Add(dateRangeFacet *DateRangeFacet) DateRangeFacets

func (DateRangeFacets) Len

func (drf DateRangeFacets) Len() int

func (DateRangeFacets) Less

func (drf DateRangeFacets) Less(i, j int) bool

func (DateRangeFacets) Swap

func (drf DateRangeFacets) Swap(i, j int)

type DocumentMatch

type DocumentMatch struct {
	Index     string               `json:"index,omitempty"`
	ID        string               `json:"id"`
	Score     float64              `json:"score"`
	Expl      *Explanation         `json:"explanation,omitempty"`
	Locations FieldTermLocationMap `json:"locations,omitempty"`
	Fragments FieldFragmentMap     `json:"fragments,omitempty"`

	// Fields contains the values for document fields listed in
	// SearchRequest.Fields. Text fields are returned as strings, numeric
	// fields as float64s and date fields as time.RFC3339 formatted strings.
	Fields map[string]interface{} `json:"fields,omitempty"`
}

func (*DocumentMatch) AddFieldValue

func (dm *DocumentMatch) AddFieldValue(name string, value interface{})

type DocumentMatchCollection

type DocumentMatchCollection []*DocumentMatch

func (DocumentMatchCollection) Len

func (c DocumentMatchCollection) Len() int

func (DocumentMatchCollection) Less

func (c DocumentMatchCollection) Less(i, j int) bool

func (DocumentMatchCollection) Swap

func (c DocumentMatchCollection) Swap(i, j int)

type Explanation

type Explanation struct {
	Value    float64        `json:"value"`
	Message  string         `json:"message"`
	Children []*Explanation `json:"children,omitempty"`
}

func (*Explanation) String

func (expl *Explanation) String() string

type FacetBuilder

type FacetBuilder interface {
	Update(index.FieldTerms)
	Result() *FacetResult
}

type FacetResult

type FacetResult struct {
	Field         string             `json:"field"`
	Total         int                `json:"total"`
	Missing       int                `json:"missing"`
	Other         int                `json:"other"`
	Terms         TermFacets         `json:"terms,omitempty"`
	NumericRanges NumericRangeFacets `json:"numeric_ranges,omitempty"`
	DateRanges    DateRangeFacets    `json:"date_ranges,omitempty"`
}

func (*FacetResult) Fixup

func (fr *FacetResult) Fixup(size int)

func (*FacetResult) Merge

func (fr *FacetResult) Merge(other *FacetResult)

type FacetResults

type FacetResults map[string]*FacetResult

func (FacetResults) Fixup

func (fr FacetResults) Fixup(name string, size int)

func (FacetResults) Merge

func (fr FacetResults) Merge(other FacetResults)

type FacetsBuilder

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

func NewFacetsBuilder

func NewFacetsBuilder(indexReader index.IndexReader) *FacetsBuilder

func (*FacetsBuilder) Add

func (fb *FacetsBuilder) Add(name string, facetBuilder FacetBuilder)

func (*FacetsBuilder) Results

func (fb *FacetsBuilder) Results() FacetResults

func (*FacetsBuilder) Update

func (fb *FacetsBuilder) Update(docMatch *DocumentMatch) error

type FieldFragmentMap

type FieldFragmentMap map[string][]string

type FieldTermLocationMap

type FieldTermLocationMap map[string]TermLocationMap

func MergeLocations

func MergeLocations(locations []FieldTermLocationMap) FieldTermLocationMap

type Location

type Location struct {
	Pos            float64   `json:"pos"`
	Start          float64   `json:"start"`
	End            float64   `json:"end"`
	ArrayPositions []float64 `json:"array_positions"`
}

func (*Location) SameArrayElement

func (l *Location) SameArrayElement(other *Location) bool

SameArrayElement returns true if two locations are point to the same array element

type Locations

type Locations []*Location

type NumericRangeFacet

type NumericRangeFacet struct {
	Name  string   `json:"name"`
	Min   *float64 `json:"min,omitempty"`
	Max   *float64 `json:"max,omitempty"`
	Count int      `json:"count"`
}

type NumericRangeFacets

type NumericRangeFacets []*NumericRangeFacet

func (NumericRangeFacets) Add

func (nrf NumericRangeFacets) Add(numericRangeFacet *NumericRangeFacet) NumericRangeFacets

func (NumericRangeFacets) Len

func (nrf NumericRangeFacets) Len() int

func (NumericRangeFacets) Less

func (nrf NumericRangeFacets) Less(i, j int) bool

func (NumericRangeFacets) Swap

func (nrf NumericRangeFacets) Swap(i, j int)

type Searcher

type Searcher interface {
	Next() (*DocumentMatch, error)
	Advance(ID string) (*DocumentMatch, error)
	Close() error
	Weight() float64
	SetQueryNorm(float64)
	Count() uint64
	Min() int
}

type TermFacet

type TermFacet struct {
	Term  string `json:"term"`
	Count int    `json:"count"`
}

type TermFacets

type TermFacets []*TermFacet

func (TermFacets) Add

func (tf TermFacets) Add(termFacet *TermFacet) TermFacets

func (TermFacets) Len

func (tf TermFacets) Len() int

func (TermFacets) Less

func (tf TermFacets) Less(i, j int) bool

func (TermFacets) Swap

func (tf TermFacets) Swap(i, j int)

type TermLocationMap

type TermLocationMap map[string]Locations

func MergeTermLocationMaps

func MergeTermLocationMaps(rv, other TermLocationMap) TermLocationMap

func (TermLocationMap) AddLocation

func (t TermLocationMap) AddLocation(term string, location *Location)

Jump to

Keyboard shortcuts

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