bleve

package module
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: 79 Imported by: 0

README

bleve bleve

modern text indexing in go - blevesearch.com

Features

  • Index any go data structure (including JSON)
  • Intelligent defaults backed up by powerful configuration
  • Supported field types:
    • Text, Numeric, Date
  • Supported query types:
    • Term, Phrase, Match, Match Phrase
    • Conjunction, Disjunction, Boolean
    • Numeric Range, Date Range
    • Simple query syntax for human entry
  • Search result match highlighting

Discussion

Discuss usage and development of bleve in the google group.

Indexing

	message := struct{
		From: "marty.schoch@gmail.com",
		Body: "bleve indexing is easy",
	}

	mapping := bleve.NewIndexMapping()
	index, _ := bleve.New("example.bleve", mapping)
	index.Index(message)

Querying

	index, _ := bleve.Open("example.bleve")
	query := bleve.NewSyntaxQuery("bleve")
	searchRequest := bleve.NewSearchRequest(query)
	searchResult, _ := index.Search(searchRequest)

Status

Build Status Coverage Status

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.

Index

Constants

View Source
const BOOST = 57351
View Source
const COLON = 57350
View Source
const DefaultAnalyzer = "standard"
View Source
const DefaultByteArrayConverter = "json"
View Source
const DefaultDateTimeParser = "dateTimeOptional"
View Source
const DefaultField = "_all"
View Source
const DefaultType = "_default"
View Source
const DefaultTypeField = "_type"
View Source
const INT = 57354
View Source
const LPAREN = 57352
View Source
const MINUS = 57349
View Source
const PATH_SEPARATOR = "."
View Source
const PHRASE = 57347
View Source
const PLUS = 57348
View Source
const RPAREN = 57353
View Source
const STRING = 57346

Variables

This section is empty.

Functions

func NewIndexMeta

func NewIndexMeta(storage string) *indexMeta

func OpenIndexMeta

func OpenIndexMeta(path string) (*indexMeta, error)

Types

type Batch

type Batch map[string]interface{}

func NewBatch

func NewBatch() Batch

func (Batch) Delete

func (b Batch) Delete(id string)

func (Batch) Index

func (b Batch) Index(id string, data interface{})

type BooleanQuery

type BooleanQuery struct {
	Must     *ConjunctionQuery `json:"must,omitempty"`
	Should   *DisjunctionQuery `json:"should,omitempty"`
	MustNot  *DisjunctionQuery `json:"must_not,omitempty"`
	BoostVal float64           `json:"boost,omitempty"`
}

func NewBooleanQuery

func NewBooleanQuery(must *ConjunctionQuery, should *DisjunctionQuery, mustNot *DisjunctionQuery) *BooleanQuery

func (*BooleanQuery) Boost

func (q *BooleanQuery) Boost() float64

func (*BooleanQuery) Searcher

func (q *BooleanQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*BooleanQuery) SetBoost

func (q *BooleanQuery) SetBoost(b float64) *BooleanQuery

func (*BooleanQuery) Validate

func (q *BooleanQuery) Validate() error

type ByteArrayConverter

type ByteArrayConverter interface {
	Convert([]byte) (interface{}, error)
}

type Classifier

type Classifier interface {
	Type() string
}

type Configuration

type Configuration struct {
	Highlight           *HighlightConfig
	DefaultHighlighter  *string
	ByteArrayConverters map[string]ByteArrayConverter
	DefaultKVStore      string
}
var Config *Configuration

func NewConfiguration

func NewConfiguration() *Configuration

type ConjunctionQuery

type ConjunctionQuery struct {
	Conjuncts []Query `json:"terms"`
	BoostVal  float64 `json:"boost,omitempty"`
}

func NewConjunctionQuery

func NewConjunctionQuery(conjuncts []Query) *ConjunctionQuery

func (*ConjunctionQuery) AddQuery

func (q *ConjunctionQuery) AddQuery(aq Query) *ConjunctionQuery

func (*ConjunctionQuery) Boost

func (q *ConjunctionQuery) Boost() float64

func (*ConjunctionQuery) Searcher

func (q *ConjunctionQuery) Searcher(i *indexImpl, explain bool) (*search.ConjunctionSearcher, error)

func (*ConjunctionQuery) SetBoost

func (q *ConjunctionQuery) SetBoost(b float64) *ConjunctionQuery

func (*ConjunctionQuery) UnmarshalJSON

func (q *ConjunctionQuery) UnmarshalJSON(data []byte) error

func (*ConjunctionQuery) Validate

func (q *ConjunctionQuery) Validate() error

type DateRangeQuery

type DateRangeQuery struct {
	Start          *string `json:"start,omitempty"`
	End            *string `json:"end,omitempty"`
	FieldVal       string  `json:"field,omitempty"`
	BoostVal       float64 `json:"boost,omitempty"`
	DateTimeParser *string `json:"datetime_parser,omitempty"`
}

func NewDateRangeQuery

func NewDateRangeQuery(start, end *string) *DateRangeQuery

func (*DateRangeQuery) Boost

func (q *DateRangeQuery) Boost() float64

func (*DateRangeQuery) Field

func (q *DateRangeQuery) Field() string

func (*DateRangeQuery) Searcher

func (q *DateRangeQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*DateRangeQuery) SetBoost

func (q *DateRangeQuery) SetBoost(b float64) *DateRangeQuery

func (*DateRangeQuery) SetField

func (q *DateRangeQuery) SetField(f string) *DateRangeQuery

func (*DateRangeQuery) Validate

func (q *DateRangeQuery) Validate() error

type DateTimeRange

type DateTimeRange struct {
	Name  string    `json:"name,omitempty"`
	Start time.Time `json:"start,omitempty"`
	End   time.Time `json:"end,omitempty"`
	// contains filtered or unexported fields
}

func (*DateTimeRange) ParseDates

func (dr *DateTimeRange) ParseDates(dateTimeParser analysis.DateTimeParser)

func (*DateTimeRange) UnmarshalJSON

func (dr *DateTimeRange) UnmarshalJSON(input []byte) error

type DisjunctionQuery

type DisjunctionQuery struct {
	Disjuncts []Query `json:"terms"`
	BoostVal  float64 `json:"boost,omitempty"`
	MinVal    float64 `json:"min"`
}

func NewDisjunctionQuery

func NewDisjunctionQuery(disjuncts []Query) *DisjunctionQuery

func (*DisjunctionQuery) AddQuery

func (q *DisjunctionQuery) AddQuery(aq Query) *DisjunctionQuery

func (*DisjunctionQuery) Boost

func (q *DisjunctionQuery) Boost() float64

func (*DisjunctionQuery) Min

func (q *DisjunctionQuery) Min() float64

func (*DisjunctionQuery) Searcher

func (q *DisjunctionQuery) Searcher(i *indexImpl, explain bool) (*search.DisjunctionSearcher, error)

func (*DisjunctionQuery) SetBoost

func (q *DisjunctionQuery) SetBoost(b float64) *DisjunctionQuery

func (*DisjunctionQuery) SetMin

func (*DisjunctionQuery) UnmarshalJSON

func (q *DisjunctionQuery) UnmarshalJSON(data []byte) error

func (*DisjunctionQuery) Validate

func (q *DisjunctionQuery) Validate() error

type DocumentMapping

type DocumentMapping struct {
	Enabled         bool                        `json:"enabled"`
	Dynamic         bool                        `json:"dynamic"`
	Properties      map[string]*DocumentMapping `json:"properties"`
	Fields          []*FieldMapping             `json:"fields"`
	DefaultAnalyzer string                      `json:"default_analyzer"`
}

func NewDocumentDisabledMapping

func NewDocumentDisabledMapping() *DocumentMapping

func NewDocumentMapping

func NewDocumentMapping() *DocumentMapping

func NewDocumentStaticMapping

func NewDocumentStaticMapping() *DocumentMapping

func (*DocumentMapping) AddFieldMapping

func (dm *DocumentMapping) AddFieldMapping(fm *FieldMapping) *DocumentMapping

func (*DocumentMapping) AddSubDocumentMapping

func (dm *DocumentMapping) AddSubDocumentMapping(property string, sdm *DocumentMapping) *DocumentMapping

func (*DocumentMapping) DocumentMappingForPath

func (dm *DocumentMapping) DocumentMappingForPath(path string) *DocumentMapping

func (*DocumentMapping) GoString

func (dm *DocumentMapping) GoString() string

func (*DocumentMapping) UnmarshalJSON

func (dm *DocumentMapping) UnmarshalJSON(data []byte) error

func (*DocumentMapping) Validate

func (dm *DocumentMapping) Validate(cache *registry.Cache) error

type Error

type Error int
const (
	ERROR_INDEX_PATH_EXISTS Error = iota
	ERROR_INDEX_PATH_DOES_NOT_EXIST
	ERROR_INDEX_META_MISSING
	ERROR_INDEX_META_CORRUPT
	ERROR_DISJUNCTION_FEWER_THAN_MIN_CLAUSES
	ERROR_BOOLEAN_QUERY_NEEDS_MUST_OR_SHOULD
	ERROR_NUMERIC_QUERY_NO_BOUNDS
	ERROR_PHRASE_QUERY_NO_TERMS
	ERROR_UNKNOWN_QUERY_TYPE
	ERROR_UNKNOWN_STORAGE_TYPE
)

func (Error) Error

func (e Error) Error() string

type FacetRequest

type FacetRequest struct {
	Size           int
	Field          string
	NumericRanges  []*NumericRange  `json:"numeric_ranges,omitempty"`
	DateTimeRanges []*DateTimeRange `json:"date_ranges,omitempty"`
}

func NewFacetRequest

func NewFacetRequest(field string, size int) *FacetRequest

func (*FacetRequest) AddDateTimeRange

func (fr *FacetRequest) AddDateTimeRange(name string, start, end time.Time)

func (*FacetRequest) AddNumericRange

func (fr *FacetRequest) AddNumericRange(name string, min, max *float64)

type FacetsRequest

type FacetsRequest map[string]*FacetRequest

type FieldMapping

type FieldMapping struct {
	Name               *string `json:"name"`
	Type               *string `json:"type"`
	Analyzer           *string `json:"analyzer"`
	Store              *bool   `json:"store"`
	Index              *bool   `json:"index"`
	IncludeTermVectors *bool   `json:"include_term_vectors"`
	IncludeInAll       *bool   `json:"include_in_all"`
	DateFormat         *string `json:"date_format"`
}

func NewFieldMapping

func NewFieldMapping(name, typ, analyzer string, store, index bool, includeTermVectors bool, includeInAll bool) *FieldMapping

func (*FieldMapping) GoString

func (fm *FieldMapping) GoString() string

func (*FieldMapping) Options

func (fm *FieldMapping) Options() document.IndexingOptions

type HighlightConfig

type HighlightConfig struct {
	Highlighters map[string]search.Highlighter
}

type HighlightRequest

type HighlightRequest struct {
	Style  *string  `json:"style"`
	Fields []string `json:"fields"`
}

func NewHighlight

func NewHighlight() *HighlightRequest

func NewHighlightWithStyle

func NewHighlightWithStyle(style string) *HighlightRequest

type IgnoreByteArrayConverter

type IgnoreByteArrayConverter struct{}

func NewIgnoreByteArrayConverter

func NewIgnoreByteArrayConverter() *IgnoreByteArrayConverter

func (*IgnoreByteArrayConverter) Convert

func (c *IgnoreByteArrayConverter) Convert(in []byte) (interface{}, error)

type Index

type Index interface {
	Index(id string, data interface{}) error
	Delete(id string) error

	Batch(b Batch) error

	Document(id string) (*document.Document, error)
	DocCount() uint64

	Search(req *SearchRequest) (*SearchResult, error)

	Fields() ([]string, error)

	DumpAll() chan interface{}
	DumpDoc(id string) chan interface{}
	DumpFields() chan interface{}

	Close()
}

func New

func New(path string, mapping *IndexMapping) (Index, error)

New index at the specified path, must not exist. The provided mapping will be used for all Index/Search operations.

func Open

func Open(path string) (Index, error)

Open index at the specified path, must exist. The mapping used when it was created will be used for all Index/Search operations.

type IndexMapping

type IndexMapping struct {
	TypeMapping           map[string]*DocumentMapping `json:"types"`
	DefaultMapping        *DocumentMapping            `json:"default_mapping"`
	TypeField             string                      `json:"type_field"`
	DefaultType           string                      `json:"default_type"`
	DefaultAnalyzer       string                      `json:"default_analyzer"`
	DefaultDateTimeParser string                      `json:"default_datetime_parser"`
	DefaultField          string                      `json:"default_field"`
	ByteArrayConverter    string                      `json:"byte_array_converter"`
	// contains filtered or unexported fields
}

func NewIndexMapping

func NewIndexMapping() *IndexMapping

func (*IndexMapping) AddDocumentMapping

func (im *IndexMapping) AddDocumentMapping(doctype string, dm *DocumentMapping) *IndexMapping

func (*IndexMapping) AnalyzerNamed

func (im *IndexMapping) AnalyzerNamed(name string) *analysis.Analyzer

func (*IndexMapping) DateTimeParserNamed

func (im *IndexMapping) DateTimeParserNamed(name string) analysis.DateTimeParser

func (*IndexMapping) GoString

func (im *IndexMapping) GoString() string

func (*IndexMapping) MapDocument

func (im *IndexMapping) MapDocument(doc *document.Document, data interface{}) error

func (*IndexMapping) MappingForType

func (im *IndexMapping) MappingForType(docType string) *DocumentMapping

func (*IndexMapping) SetByteArrayConverter

func (im *IndexMapping) SetByteArrayConverter(byteArrayConverter string) *IndexMapping

func (*IndexMapping) SetDefaultAnalyzer

func (im *IndexMapping) SetDefaultAnalyzer(analyzer string) *IndexMapping

func (*IndexMapping) SetDefaultField

func (im *IndexMapping) SetDefaultField(field string) *IndexMapping

func (*IndexMapping) SetDefaultMapping

func (im *IndexMapping) SetDefaultMapping(defaultMapping *DocumentMapping) *IndexMapping

func (*IndexMapping) SetDefaultType

func (im *IndexMapping) SetDefaultType(defaultType string) *IndexMapping

func (*IndexMapping) SetTypeField

func (im *IndexMapping) SetTypeField(typeField string) *IndexMapping

func (*IndexMapping) UnmarshalJSON

func (im *IndexMapping) UnmarshalJSON(data []byte) error

func (*IndexMapping) Validate

func (im *IndexMapping) Validate() error

Validate will walk the entire structure ensuring the following explicitly named and default analyzers can be built explicitly named and default date parsers can be built field type names are valid

type JSONByteArrayConverter

type JSONByteArrayConverter struct{}

func NewJSONByteArrayConverter

func NewJSONByteArrayConverter() *JSONByteArrayConverter

func (*JSONByteArrayConverter) Convert

func (c *JSONByteArrayConverter) Convert(in []byte) (interface{}, error)

type Lexer

type Lexer []*frame

func NewLexer

func NewLexer(in io.Reader) Lexer

func (Lexer) Error

func (yylex Lexer) Error(e string)

func (Lexer) Lex

func (yylex Lexer) Lex(lval *yySymType) int

func (Lexer) Text

func (stack Lexer) Text() string

type MatchAllQuery

type MatchAllQuery struct {
	BoostVal float64 `json:"boost,omitempty"`
}

func NewMatchAllQuery

func NewMatchAllQuery() *MatchAllQuery

func (*MatchAllQuery) Boost

func (q *MatchAllQuery) Boost() float64

func (*MatchAllQuery) Searcher

func (q *MatchAllQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*MatchAllQuery) SetBoost

func (q *MatchAllQuery) SetBoost(b float64) *MatchAllQuery

func (*MatchAllQuery) Validate

func (q *MatchAllQuery) Validate() error

type MatchNoneQuery

type MatchNoneQuery struct {
	BoostVal float64 `json:"boost,omitempty"`
}

func NewMatchNoneQuery

func NewMatchNoneQuery() *MatchNoneQuery

func (*MatchNoneQuery) Boost

func (q *MatchNoneQuery) Boost() float64

func (*MatchNoneQuery) Searcher

func (q *MatchNoneQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*MatchNoneQuery) SetBoost

func (q *MatchNoneQuery) SetBoost(b float64) *MatchNoneQuery

func (*MatchNoneQuery) Validate

func (q *MatchNoneQuery) Validate() error

type MatchPhraseQuery

type MatchPhraseQuery struct {
	MatchPhrase string  `json:"match_phrase"`
	FieldVal    string  `json:"field,omitempty"`
	Analyzer    string  `json:"analyzer,omitempty"`
	BoostVal    float64 `json:"boost,omitempty"`
}

func NewMatchPhraseQuery

func NewMatchPhraseQuery(matchPhrase string) *MatchPhraseQuery

func (*MatchPhraseQuery) Boost

func (q *MatchPhraseQuery) Boost() float64

func (*MatchPhraseQuery) Field

func (q *MatchPhraseQuery) Field() string

func (*MatchPhraseQuery) Searcher

func (q *MatchPhraseQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*MatchPhraseQuery) SetBoost

func (q *MatchPhraseQuery) SetBoost(b float64) *MatchPhraseQuery

func (*MatchPhraseQuery) SetField

func (q *MatchPhraseQuery) SetField(f string) *MatchPhraseQuery

func (*MatchPhraseQuery) Validate

func (q *MatchPhraseQuery) Validate() error

type MatchQuery

type MatchQuery struct {
	Match    string  `json:"match"`
	FieldVal string  `json:"field,omitempty"`
	Analyzer string  `json:"analyzer,omitempty"`
	BoostVal float64 `json:"boost,omitempty"`
}

func NewMatchQuery

func NewMatchQuery(match string) *MatchQuery

func (*MatchQuery) Boost

func (q *MatchQuery) Boost() float64

func (*MatchQuery) Field

func (q *MatchQuery) Field() string

func (*MatchQuery) Searcher

func (q *MatchQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*MatchQuery) SetBoost

func (q *MatchQuery) SetBoost(b float64) *MatchQuery

func (*MatchQuery) SetField

func (q *MatchQuery) SetField(f string) *MatchQuery

func (*MatchQuery) Validate

func (q *MatchQuery) Validate() error

type NumericRange

type NumericRange struct {
	Name string   `json:"name,omitempty"`
	Min  *float64 `json:"min,omitempty"`
	Max  *float64 `json:"max,omitempty"`
}

type NumericRangeQuery

type NumericRangeQuery struct {
	Min      *float64 `json:"min,omitempty"`
	Max      *float64 `json:"max,omitempty"`
	FieldVal string   `json:"field,omitempty"`
	BoostVal float64  `json:"boost,omitempty"`
}

func NewNumericRangeQuery

func NewNumericRangeQuery(min, max *float64) *NumericRangeQuery

func (*NumericRangeQuery) Boost

func (q *NumericRangeQuery) Boost() float64

func (*NumericRangeQuery) Field

func (q *NumericRangeQuery) Field() string

func (*NumericRangeQuery) Searcher

func (q *NumericRangeQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*NumericRangeQuery) SetBoost

func (*NumericRangeQuery) SetField

func (q *NumericRangeQuery) SetField(f string) *NumericRangeQuery

func (*NumericRangeQuery) Validate

func (q *NumericRangeQuery) Validate() error

type PhraseQuery

type PhraseQuery struct {
	Terms    []*TermQuery `json:"terms"`
	BoostVal float64      `json:"boost,omitempty"`
}

func NewPhraseQuery

func NewPhraseQuery(terms []*TermQuery) *PhraseQuery

func (*PhraseQuery) Boost

func (q *PhraseQuery) Boost() float64

func (*PhraseQuery) Searcher

func (q *PhraseQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*PhraseQuery) SetBoost

func (q *PhraseQuery) SetBoost(b float64) *PhraseQuery

func (*PhraseQuery) Validate

func (q *PhraseQuery) Validate() error

type PrefixQuery

type PrefixQuery struct {
	Prefix   string  `json:"prefix"`
	FieldVal string  `json:"field,omitempty"`
	BoostVal float64 `json:"boost,omitempty"`
}

func NewPrefixQuery

func NewPrefixQuery(prefix string) *PrefixQuery

func (*PrefixQuery) Boost

func (q *PrefixQuery) Boost() float64

func (*PrefixQuery) Field

func (q *PrefixQuery) Field() string

func (*PrefixQuery) Searcher

func (q *PrefixQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*PrefixQuery) SetBoost

func (q *PrefixQuery) SetBoost(b float64) *PrefixQuery

func (*PrefixQuery) SetField

func (q *PrefixQuery) SetField(f string) *PrefixQuery

func (*PrefixQuery) Validate

func (q *PrefixQuery) Validate() error

type Query

type Query interface {
	Boost() float64
	Searcher(i *indexImpl, explain bool) (search.Searcher, error)
	Validate() error
}

func ParseQuery

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

func ParseQuerySyntax

func ParseQuerySyntax(query string, mapping *IndexMapping) (rq Query, err error)

type SearchRequest

type SearchRequest struct {
	Query     Query             `json:"query"`
	Size      int               `json:"size"`
	From      int               `json:"from"`
	Highlight *HighlightRequest `json:"highlight"`
	Fields    []string          `json:"fields"`
	Facets    FacetsRequest     `json:"facets"`
	Explain   bool              `json:"explain"`
}

func NewSearchRequest

func NewSearchRequest(q Query) *SearchRequest

func NewSearchRequestOptions

func NewSearchRequestOptions(q Query, size, from int, explain bool) *SearchRequest

func (*SearchRequest) AddFacet

func (r *SearchRequest) AddFacet(facetName string, f *FacetRequest)

func (*SearchRequest) UnmarshalJSON

func (r *SearchRequest) UnmarshalJSON(input []byte) error

type SearchResult

type SearchResult struct {
	Request  *SearchRequest                 `json:"request"`
	Hits     search.DocumentMatchCollection `json:"hits"`
	Total    uint64                         `json:"total_hits"`
	MaxScore float64                        `json:"max_score"`
	Took     time.Duration                  `json:"took"`
	Facets   search.FacetResults            `json:"facets"`
}

func (*SearchResult) String

func (sr *SearchResult) String() string

type StringByteArrayConverter

type StringByteArrayConverter struct{}

func NewStringByteArrayConverter

func NewStringByteArrayConverter() *StringByteArrayConverter

func (*StringByteArrayConverter) Convert

func (c *StringByteArrayConverter) Convert(in []byte) (interface{}, error)

type SyntaxQuery

type SyntaxQuery struct {
	Query    string  `json:"query"`
	BoostVal float64 `json:"boost,omitempty"`
}

func NewSyntaxQuery

func NewSyntaxQuery(query string) *SyntaxQuery

func (*SyntaxQuery) Boost

func (q *SyntaxQuery) Boost() float64

func (*SyntaxQuery) Searcher

func (q *SyntaxQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*SyntaxQuery) SetBoost

func (q *SyntaxQuery) SetBoost(b float64) *SyntaxQuery

func (*SyntaxQuery) Validate

func (q *SyntaxQuery) Validate() error

type TermQuery

type TermQuery struct {
	Term     string  `json:"term"`
	FieldVal string  `json:"field,omitempty"`
	BoostVal float64 `json:"boost,omitempty"`
}

func NewTermQuery

func NewTermQuery(term string) *TermQuery

func (*TermQuery) Boost

func (q *TermQuery) Boost() float64

func (*TermQuery) Field

func (q *TermQuery) Field() string

func (*TermQuery) Searcher

func (q *TermQuery) Searcher(i *indexImpl, explain bool) (search.Searcher, error)

func (*TermQuery) SetBoost

func (q *TermQuery) SetBoost(b float64) *TermQuery

func (*TermQuery) SetField

func (q *TermQuery) SetField(f string) *TermQuery

func (*TermQuery) Validate

func (q *TermQuery) Validate() error

Jump to

Keyboard shortcuts

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