search

package
v0.0.0-...-27f001b Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2014 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const DEFAULT_ANSI_HIGHLIGHT = bgYellow
View Source
const DEFAULT_FRAGMENT_SIZE = 100
View Source
const DEFAULT_HTML_HIGHLIGHT_AFTER = "</b>"
View Source
const DEFAULT_HTML_HIGHLIGHT_BEFORE = "<b>"
View Source
const DEFAULT_SEPARATOR = "…"
View Source
const MAX_SCORE_CACHE = 64
View Source
const MAX_SQRT_CACHE = 64

Variables

View Source
var SQRT_CACHE map[int]float64

Functions

func OrderTermLocations

func OrderTermLocations(tlm TermLocationMap) termLocations

Types

type ANSIFragmentFormatter

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

func NewANSIFragmentFormatter

func NewANSIFragmentFormatter() *ANSIFragmentFormatter

func (*ANSIFragmentFormatter) Format

type BooleanSearcher

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

func NewBooleanSearcher

func NewBooleanSearcher(index index.Index, mustSearcher *ConjunctionSearcher, shouldSearcher *DisjunctionSearcher, mustNotSearcher *DisjunctionSearcher, explain bool) (*BooleanSearcher, error)

func (*BooleanSearcher) Advance

func (s *BooleanSearcher) Advance(ID string) (*DocumentMatch, error)

func (*BooleanSearcher) Close

func (s *BooleanSearcher) Close()

func (*BooleanSearcher) Count

func (s *BooleanSearcher) Count() uint64

func (*BooleanSearcher) Next

func (s *BooleanSearcher) Next() (*DocumentMatch, error)

func (*BooleanSearcher) SetQueryNorm

func (s *BooleanSearcher) SetQueryNorm(qnorm float64)

func (*BooleanSearcher) Weight

func (s *BooleanSearcher) Weight() float64

type Collector

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

type ConjunctionQueryScorer

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

func NewConjunctionQueryScorer

func NewConjunctionQueryScorer(explain bool) *ConjunctionQueryScorer

func (*ConjunctionQueryScorer) Score

func (s *ConjunctionQueryScorer) Score(constituents []*DocumentMatch) *DocumentMatch

type ConjunctionSearcher

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

func NewConjunctionSearcher

func NewConjunctionSearcher(index index.Index, qsearchers []Searcher, explain bool) (*ConjunctionSearcher, error)

func (*ConjunctionSearcher) Advance

func (s *ConjunctionSearcher) Advance(ID string) (*DocumentMatch, error)

func (*ConjunctionSearcher) Close

func (s *ConjunctionSearcher) Close()

func (*ConjunctionSearcher) Count

func (s *ConjunctionSearcher) Count() uint64

func (*ConjunctionSearcher) Next

func (s *ConjunctionSearcher) Next() (*DocumentMatch, error)

func (*ConjunctionSearcher) SetQueryNorm

func (s *ConjunctionSearcher) SetQueryNorm(qnorm float64)

func (*ConjunctionSearcher) Weight

func (s *ConjunctionSearcher) Weight() float64

type ConstantScorer

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

func NewConstantScorer

func NewConstantScorer(constant float64, boost float64, explain bool) *ConstantScorer

func (*ConstantScorer) Score

func (s *ConstantScorer) Score(id string) *DocumentMatch

func (*ConstantScorer) SetQueryNorm

func (s *ConstantScorer) SetQueryNorm(qnorm float64)

func (*ConstantScorer) Weight

func (s *ConstantScorer) Weight() float64

type DateRangeFacet

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

type DateTimeFacetBuilder

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

func NewDateTimeFacetBuilder

func NewDateTimeFacetBuilder(field string, size int) *DateTimeFacetBuilder

func (*DateTimeFacetBuilder) AddRange

func (fb *DateTimeFacetBuilder) AddRange(name string, start, end time.Time)

func (*DateTimeFacetBuilder) Result

func (fb *DateTimeFacetBuilder) Result() FacetResult

func (*DateTimeFacetBuilder) Update

func (fb *DateTimeFacetBuilder) Update(ft index.FieldTerms)

type DisjunctionQueryScorer

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

func NewDisjunctionQueryScorer

func NewDisjunctionQueryScorer(explain bool) *DisjunctionQueryScorer

func (*DisjunctionQueryScorer) Score

func (s *DisjunctionQueryScorer) Score(constituents []*DocumentMatch, countMatch, countTotal int) *DocumentMatch

type DisjunctionSearcher

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

func NewDisjunctionSearcher

func NewDisjunctionSearcher(index index.Index, qsearchers []Searcher, min float64, explain bool) (*DisjunctionSearcher, error)

func (*DisjunctionSearcher) Advance

func (s *DisjunctionSearcher) Advance(ID string) (*DocumentMatch, error)

func (*DisjunctionSearcher) Close

func (s *DisjunctionSearcher) Close()

func (*DisjunctionSearcher) Count

func (s *DisjunctionSearcher) Count() uint64

func (*DisjunctionSearcher) Next

func (s *DisjunctionSearcher) Next() (*DocumentMatch, error)

func (*DisjunctionSearcher) SetQueryNorm

func (s *DisjunctionSearcher) SetQueryNorm(qnorm float64)

func (*DisjunctionSearcher) Weight

func (s *DisjunctionSearcher) Weight() float64

type DocumentMatch

type DocumentMatch struct {
	ID        string                 `json:"id"`
	Score     float64                `json:"score"`
	Expl      *Explanation           `json:"explanation,omitempty"`
	Locations FieldTermLocationMap   `json:"locations,omitempty"`
	Fragments FieldFragmentMap       `json:"fragments,omitempty"`
	Fields    map[string]interface{} `json:"fields,omitempty"`
}

func (*DocumentMatch) AddFieldValue

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

type DocumentMatchCollection

type DocumentMatchCollection []*DocumentMatch

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         []*TermFacet         `json:"terms,omitempty"`
	NumericRanges []*NumericRangeFacet `json:"numeric_ranges,omitempty"`
	DateRanges    []*DateRangeFacet    `json:"date_ranges,omitempty"`
}

type FacetResults

type FacetResults map[string]FacetResult

type FacetsBuilder

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

func NewFacetsBuilder

func NewFacetsBuilder(index index.Index) *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

type Fragment

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

func (*Fragment) Overlaps

func (f *Fragment) Overlaps(other *Fragment) bool

type FragmentFormatter

type FragmentFormatter interface {
	Format(f *Fragment, tlm TermLocationMap) string
}

type FragmentQueue

type FragmentQueue []*Fragment

A PriorityQueue implements heap.Interface and holds Items.

func (FragmentQueue) Len

func (fq FragmentQueue) Len() int

func (FragmentQueue) Less

func (fq FragmentQueue) Less(i, j int) bool

func (*FragmentQueue) Pop

func (fq *FragmentQueue) Pop() interface{}

func (*FragmentQueue) Push

func (fq *FragmentQueue) Push(x interface{})

func (FragmentQueue) Swap

func (fq FragmentQueue) Swap(i, j int)

type FragmentScorer

type FragmentScorer interface {
	Score(f *Fragment) float64
}

type Fragmenter

type Fragmenter interface {
	Fragment([]byte, termLocations) []*Fragment
}

type HTMLFragmentFormatter

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

func NewHTMLFragmentFormatter

func NewHTMLFragmentFormatter() *HTMLFragmentFormatter

func NewHTMLFragmentFormatterCustom

func NewHTMLFragmentFormatterCustom(before, after string) *HTMLFragmentFormatter

func (*HTMLFragmentFormatter) Format

type Highlighter

type Highlighter interface {
	Fragmenter() Fragmenter
	SetFragmenter(Fragmenter)

	FragmentFormatter() FragmentFormatter
	SetFragmentFormatter(FragmentFormatter)

	Separator() string
	SetSeparator(string)

	BestFragmentInField(*DocumentMatch, *document.Document, string) string
	BestFragmentsInField(*DocumentMatch, *document.Document, string, int) []string
}

type Location

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

type Locations

type Locations []*Location

type MatchAllSearcher

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

func NewMatchAllSearcher

func NewMatchAllSearcher(index index.Index, boost float64, explain bool) (*MatchAllSearcher, error)

func (*MatchAllSearcher) Advance

func (s *MatchAllSearcher) Advance(ID string) (*DocumentMatch, error)

func (*MatchAllSearcher) Close

func (s *MatchAllSearcher) Close()

func (*MatchAllSearcher) Count

func (s *MatchAllSearcher) Count() uint64

func (*MatchAllSearcher) Next

func (s *MatchAllSearcher) Next() (*DocumentMatch, error)

func (*MatchAllSearcher) SetQueryNorm

func (s *MatchAllSearcher) SetQueryNorm(qnorm float64)

func (*MatchAllSearcher) Weight

func (s *MatchAllSearcher) Weight() float64

type MatchNoneSearcher

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

func NewMatchNoneSearcher

func NewMatchNoneSearcher(index index.Index) (*MatchNoneSearcher, error)

func (*MatchNoneSearcher) Advance

func (s *MatchNoneSearcher) Advance(ID string) (*DocumentMatch, error)

func (*MatchNoneSearcher) Close

func (s *MatchNoneSearcher) Close()

func (*MatchNoneSearcher) Count

func (s *MatchNoneSearcher) Count() uint64

func (*MatchNoneSearcher) Next

func (s *MatchNoneSearcher) Next() (*DocumentMatch, error)

func (*MatchNoneSearcher) SetQueryNorm

func (s *MatchNoneSearcher) SetQueryNorm(qnorm float64)

func (*MatchNoneSearcher) Weight

func (s *MatchNoneSearcher) Weight() float64

type NumericFacetBuilder

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

func NewNumericFacetBuilder

func NewNumericFacetBuilder(field string, size int) *NumericFacetBuilder

func (*NumericFacetBuilder) AddRange

func (fb *NumericFacetBuilder) AddRange(name string, min, max *float64)

func (*NumericFacetBuilder) Result

func (fb *NumericFacetBuilder) Result() FacetResult

func (*NumericFacetBuilder) Update

func (fb *NumericFacetBuilder) Update(ft index.FieldTerms)

type NumericRangeFacet

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

type NumericRangeSearcher

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

func NewNumericRangeSearcher

func NewNumericRangeSearcher(index index.Index, min *float64, max *float64, field string, boost float64, explain bool) (*NumericRangeSearcher, error)

func (*NumericRangeSearcher) Advance

func (s *NumericRangeSearcher) Advance(ID string) (*DocumentMatch, error)

func (*NumericRangeSearcher) Close

func (s *NumericRangeSearcher) Close()

func (*NumericRangeSearcher) Count

func (s *NumericRangeSearcher) Count() uint64

func (*NumericRangeSearcher) Next

func (*NumericRangeSearcher) SetQueryNorm

func (s *NumericRangeSearcher) SetQueryNorm(qnorm float64)

func (*NumericRangeSearcher) Weight

func (s *NumericRangeSearcher) Weight() float64

type OrderedSearcherList

type OrderedSearcherList []Searcher

func (OrderedSearcherList) Len

func (otrl OrderedSearcherList) Len() int

func (OrderedSearcherList) Less

func (otrl OrderedSearcherList) Less(i, j int) bool

func (OrderedSearcherList) Swap

func (otrl OrderedSearcherList) Swap(i, j int)

type PhraseSearcher

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

func NewPhraseSearcher

func NewPhraseSearcher(index index.Index, mustSearcher *ConjunctionSearcher, terms []string) (*PhraseSearcher, error)

func (*PhraseSearcher) Advance

func (s *PhraseSearcher) Advance(ID string) (*DocumentMatch, error)

func (*PhraseSearcher) Close

func (s *PhraseSearcher) Close()

func (*PhraseSearcher) Count

func (s *PhraseSearcher) Count() uint64

func (*PhraseSearcher) Next

func (s *PhraseSearcher) Next() (*DocumentMatch, error)

func (*PhraseSearcher) SetQueryNorm

func (s *PhraseSearcher) SetQueryNorm(qnorm float64)

func (*PhraseSearcher) Weight

func (s *PhraseSearcher) Weight() float64

type Searcher

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

type SimpleFragmentScorer

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

SimpleFragmentScorer will score fragments by how many unique terms occur in the fragment with no regard for any boost values used in the original query

func NewSimpleFragmentScorer

func NewSimpleFragmentScorer(tlm TermLocationMap) *SimpleFragmentScorer

func (*SimpleFragmentScorer) Score

func (s *SimpleFragmentScorer) Score(f *Fragment)

type SimpleFragmenter

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

func NewSimpleFragmenter

func NewSimpleFragmenter() *SimpleFragmenter

func NewSimpleFragmenterWithSize

func NewSimpleFragmenterWithSize(fragmentSize int) *SimpleFragmenter

func (*SimpleFragmenter) Fragment

func (s *SimpleFragmenter) Fragment(orig []byte, ot termLocations) []*Fragment

type SimpleHighlighter

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

func NewSimpleHighlighter

func NewSimpleHighlighter() *SimpleHighlighter

func (*SimpleHighlighter) BestFragmentInField

func (s *SimpleHighlighter) BestFragmentInField(dm *DocumentMatch, doc *document.Document, field string) string

func (*SimpleHighlighter) BestFragmentsInField

func (s *SimpleHighlighter) BestFragmentsInField(dm *DocumentMatch, doc *document.Document, field string, num int) []string

func (*SimpleHighlighter) FragmentFormatter

func (s *SimpleHighlighter) FragmentFormatter() FragmentFormatter

func (*SimpleHighlighter) Fragmenter

func (s *SimpleHighlighter) Fragmenter() Fragmenter

func (*SimpleHighlighter) Separator

func (s *SimpleHighlighter) Separator() string

func (*SimpleHighlighter) SetFragmentFormatter

func (s *SimpleHighlighter) SetFragmentFormatter(f FragmentFormatter)

func (*SimpleHighlighter) SetFragmenter

func (s *SimpleHighlighter) SetFragmenter(f Fragmenter)

func (*SimpleHighlighter) SetSeparator

func (s *SimpleHighlighter) SetSeparator(sep string)

type TermFacet

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

type TermLocationMap

type TermLocationMap map[string]Locations

func (TermLocationMap) AddLocation

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

type TermPrefixSearcher

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

func NewTermPrefixSearcher

func NewTermPrefixSearcher(index index.Index, prefix string, field string, boost float64, explain bool) (*TermPrefixSearcher, error)

func (*TermPrefixSearcher) Advance

func (s *TermPrefixSearcher) Advance(ID string) (*DocumentMatch, error)

func (*TermPrefixSearcher) Close

func (s *TermPrefixSearcher) Close()

func (*TermPrefixSearcher) Count

func (s *TermPrefixSearcher) Count() uint64

func (*TermPrefixSearcher) Next

func (s *TermPrefixSearcher) Next() (*DocumentMatch, error)

func (*TermPrefixSearcher) SetQueryNorm

func (s *TermPrefixSearcher) SetQueryNorm(qnorm float64)

func (*TermPrefixSearcher) Weight

func (s *TermPrefixSearcher) Weight() float64

type TermQueryScorer

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

func NewTermQueryScorer

func NewTermQueryScorer(queryTerm string, queryField string, queryBoost float64, docTotal, docTerm uint64, explain bool) *TermQueryScorer

func (*TermQueryScorer) Score

func (s *TermQueryScorer) Score(termMatch *index.TermFieldDoc) *DocumentMatch

func (*TermQueryScorer) SetQueryNorm

func (s *TermQueryScorer) SetQueryNorm(qnorm float64)

func (*TermQueryScorer) Weight

func (s *TermQueryScorer) Weight() float64

type TermSearcher

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

func NewTermSearcher

func NewTermSearcher(index index.Index, term string, field string, boost float64, explain bool) (*TermSearcher, error)

func (*TermSearcher) Advance

func (s *TermSearcher) Advance(ID string) (*DocumentMatch, error)

func (*TermSearcher) Close

func (s *TermSearcher) Close()

func (*TermSearcher) Count

func (s *TermSearcher) Count() uint64

func (*TermSearcher) Next

func (s *TermSearcher) Next() (*DocumentMatch, error)

func (*TermSearcher) SetQueryNorm

func (s *TermSearcher) SetQueryNorm(qnorm float64)

func (*TermSearcher) Weight

func (s *TermSearcher) Weight() float64

type TermsFacetBuilder

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

func NewTermsFacetBuilder

func NewTermsFacetBuilder(field string, size int) *TermsFacetBuilder

func (*TermsFacetBuilder) Result

func (fb *TermsFacetBuilder) Result() FacetResult

func (*TermsFacetBuilder) Update

func (fb *TermsFacetBuilder) Update(ft index.FieldTerms)

type TopScoreCollector

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

func NewTopScorerCollector

func NewTopScorerCollector(k int) *TopScoreCollector

func NewTopScorerSkipCollector

func NewTopScorerSkipCollector(k, skip int) *TopScoreCollector

func (*TopScoreCollector) Collect

func (tksc *TopScoreCollector) Collect(searcher Searcher) error

func (*TopScoreCollector) FacetResults

func (tksc *TopScoreCollector) FacetResults() FacetResults

func (*TopScoreCollector) MaxScore

func (tksc *TopScoreCollector) MaxScore() float64

func (*TopScoreCollector) Results

func (*TopScoreCollector) SetFacetsBuilder

func (tksc *TopScoreCollector) SetFacetsBuilder(facetsBuilder *FacetsBuilder)

func (*TopScoreCollector) Took

func (tksc *TopScoreCollector) Took() time.Duration

func (*TopScoreCollector) Total

func (tksc *TopScoreCollector) Total() uint64

Jump to

Keyboard shortcuts

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