search

package
v0.0.0-...-041b862 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2013 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright (c) 2013 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) 2013 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) 2013 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) 2013 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) 2013 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) 2013 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) 2013 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) 2013 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) 2013 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) 2013 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) 2013 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) 2013 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 MAX_SCORE_CACHE = 64
View Source
const MAX_SQRT_CACHE = 64

Variables

View Source
var SQRT_CACHE map[int]float64

Functions

This section is empty.

Types

type Collector

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

type DocumentMatch

type DocumentMatch struct {
	ID    string       `json:"id"`
	Score float64      `json:"score"`
	Expl  *Explanation `json:"explanation,omitempty"`
}

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 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 Query

type Query interface {
	GetBoost() float64
	Searcher(index index.Index) (Searcher, error)
	Validate() error
}

func ParseQuery

func ParseQuery(input []byte) (Query, error)

type Searcher

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

type TermBooleanQuery

type TermBooleanQuery struct {
	Must    *TermConjunctionQuery `json:"must,omitempty"`
	MustNot *TermDisjunctionQuery `json:"must_not,omitempty"`
	Should  *TermDisjunctionQuery `json:"should,omitempty"`
	Boost   float64               `json:"boost,omitempty"`
	Explain bool                  `json:"explain,omitempty"`
}

func (*TermBooleanQuery) GetBoost

func (q *TermBooleanQuery) GetBoost() float64

func (*TermBooleanQuery) Searcher

func (q *TermBooleanQuery) Searcher(index index.Index) (Searcher, error)

func (*TermBooleanQuery) Validate

func (q *TermBooleanQuery) Validate() error

type TermBooleanSearcher

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

func NewTermBooleanSearcher

func NewTermBooleanSearcher(index index.Index, query *TermBooleanQuery) (*TermBooleanSearcher, error)

func (*TermBooleanSearcher) Advance

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

func (*TermBooleanSearcher) Close

func (s *TermBooleanSearcher) Close()

func (*TermBooleanSearcher) Count

func (s *TermBooleanSearcher) Count() uint64

func (*TermBooleanSearcher) Next

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

func (*TermBooleanSearcher) SetQueryNorm

func (s *TermBooleanSearcher) SetQueryNorm(qnorm float64)

func (*TermBooleanSearcher) Weight

func (s *TermBooleanSearcher) Weight() float64

type TermConjunctionQuery

type TermConjunctionQuery struct {
	Terms   []Query `json:"terms"`
	Boost   float64 `json:"boost"`
	Explain bool    `json:"explain"`
}

func (*TermConjunctionQuery) GetBoost

func (q *TermConjunctionQuery) GetBoost() float64

func (*TermConjunctionQuery) Searcher

func (q *TermConjunctionQuery) Searcher(index index.Index) (Searcher, error)

func (*TermConjunctionQuery) UnmarshalJSON

func (q *TermConjunctionQuery) UnmarshalJSON(input []byte) error

func (*TermConjunctionQuery) Validate

func (q *TermConjunctionQuery) Validate() error

type TermConjunctionQueryScorer

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

func NewTermConjunctionQueryScorer

func NewTermConjunctionQueryScorer(explain bool) *TermConjunctionQueryScorer

func (*TermConjunctionQueryScorer) Score

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

type TermConjunctionSearcher

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

func NewTermConjunctionSearcher

func NewTermConjunctionSearcher(index index.Index, query *TermConjunctionQuery) (*TermConjunctionSearcher, error)

func (*TermConjunctionSearcher) Advance

func (*TermConjunctionSearcher) Close

func (s *TermConjunctionSearcher) Close()

func (*TermConjunctionSearcher) Count

func (s *TermConjunctionSearcher) Count() uint64

func (*TermConjunctionSearcher) Next

func (*TermConjunctionSearcher) SetQueryNorm

func (s *TermConjunctionSearcher) SetQueryNorm(qnorm float64)

func (*TermConjunctionSearcher) Weight

func (s *TermConjunctionSearcher) Weight() float64

type TermDisjunctionQuery

type TermDisjunctionQuery struct {
	Terms   []Query `json:"terms"`
	Boost   float64 `json:"boost"`
	Explain bool    `json:"explain"`
	Min     float64 `json:"min"`
}

func (*TermDisjunctionQuery) GetBoost

func (q *TermDisjunctionQuery) GetBoost() float64

func (*TermDisjunctionQuery) Searcher

func (q *TermDisjunctionQuery) Searcher(index index.Index) (Searcher, error)

func (*TermDisjunctionQuery) UnmarshalJSON

func (q *TermDisjunctionQuery) UnmarshalJSON(input []byte) error

func (*TermDisjunctionQuery) Validate

func (q *TermDisjunctionQuery) Validate() error

type TermDisjunctionQueryScorer

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

func NewTermDisjunctionQueryScorer

func NewTermDisjunctionQueryScorer(explain bool) *TermDisjunctionQueryScorer

func (*TermDisjunctionQueryScorer) Score

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

type TermDisjunctionSearcher

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

func NewTermDisjunctionSearcher

func NewTermDisjunctionSearcher(index index.Index, query *TermDisjunctionQuery) (*TermDisjunctionSearcher, error)

func (*TermDisjunctionSearcher) Advance

func (*TermDisjunctionSearcher) Close

func (s *TermDisjunctionSearcher) Close()

func (*TermDisjunctionSearcher) Count

func (s *TermDisjunctionSearcher) Count() uint64

func (*TermDisjunctionSearcher) Next

func (*TermDisjunctionSearcher) SetQueryNorm

func (s *TermDisjunctionSearcher) SetQueryNorm(qnorm float64)

func (*TermDisjunctionSearcher) Weight

func (s *TermDisjunctionSearcher) Weight() float64

type TermQuery

type TermQuery struct {
	Term    string  `json:"term"`
	Field   string  `json:"field,omitempty"`
	Boost   float64 `json:"boost,omitempty"`
	Explain bool    `json:"explain,omitempty"`
}

func (*TermQuery) GetBoost

func (q *TermQuery) GetBoost() float64

func (*TermQuery) Searcher

func (q *TermQuery) Searcher(index index.Index) (Searcher, error)

func (*TermQuery) Validate

func (q *TermQuery) Validate() error

type TermQueryScorer

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

func NewTermQueryScorer

func NewTermQueryScorer(query *TermQuery, 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, query *TermQuery) (*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 TopScoreCollector

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

func NewTopScorerCollector

func NewTopScorerCollector(k int) *TopScoreCollector

func (*TopScoreCollector) Collect

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

func (*TopScoreCollector) MaxScore

func (tksc *TopScoreCollector) MaxScore() float64

func (*TopScoreCollector) Results

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