Documentation ¶
Index ¶
- Constants
- Variables
- func DumpQuery(m mapping.IndexMapping, query Query) (string, error)
- func SetLog(l *log.Logger)
- type BleveQueryTime
- type BoolFieldQuery
- type BooleanQuery
- func (q *BooleanQuery) AddMust(m ...Query)
- func (q *BooleanQuery) AddMustNot(m ...Query)
- func (q *BooleanQuery) AddShould(m ...Query)
- func (q *BooleanQuery) Boost() float64
- func (q *BooleanQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *BooleanQuery) SetBoost(b float64)
- func (q *BooleanQuery) SetMinShould(minShould float64)
- func (q *BooleanQuery) UnmarshalJSON(data []byte) error
- func (q *BooleanQuery) Validate() error
- type Boost
- type BoostableQuery
- type ConjunctionQuery
- func (q *ConjunctionQuery) AddQuery(aq ...Query)
- func (q *ConjunctionQuery) Boost() float64
- func (q *ConjunctionQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *ConjunctionQuery) SetBoost(b float64)
- func (q *ConjunctionQuery) UnmarshalJSON(data []byte) error
- func (q *ConjunctionQuery) Validate() error
- type DateRangeQuery
- func (q *DateRangeQuery) Boost() float64
- func (q *DateRangeQuery) Field() string
- func (q *DateRangeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *DateRangeQuery) SetBoost(b float64)
- func (q *DateRangeQuery) SetField(f string)
- func (q *DateRangeQuery) Validate() error
- type DisjunctionQuery
- func (q *DisjunctionQuery) AddQuery(aq ...Query)
- func (q *DisjunctionQuery) Boost() float64
- func (q *DisjunctionQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *DisjunctionQuery) SetBoost(b float64)
- func (q *DisjunctionQuery) SetMin(m float64)
- func (q *DisjunctionQuery) UnmarshalJSON(data []byte) error
- func (q *DisjunctionQuery) Validate() error
- type DocIDQuery
- type FieldableQuery
- type FuzzyQuery
- func (q *FuzzyQuery) Boost() float64
- func (q *FuzzyQuery) Field() string
- func (q *FuzzyQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *FuzzyQuery) SetBoost(b float64)
- func (q *FuzzyQuery) SetField(f string)
- func (q *FuzzyQuery) SetFuzziness(f int)
- func (q *FuzzyQuery) SetPrefix(p int)
- type GeoBoundingBoxQuery
- func (q *GeoBoundingBoxQuery) Boost() float64
- func (q *GeoBoundingBoxQuery) Field() string
- func (q *GeoBoundingBoxQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *GeoBoundingBoxQuery) SetBoost(b float64)
- func (q *GeoBoundingBoxQuery) SetField(f string)
- func (q *GeoBoundingBoxQuery) UnmarshalJSON(data []byte) error
- func (q *GeoBoundingBoxQuery) Validate() error
- type GeoBoundingPolygonQuery
- func (q *GeoBoundingPolygonQuery) Boost() float64
- func (q *GeoBoundingPolygonQuery) Field() string
- func (q *GeoBoundingPolygonQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *GeoBoundingPolygonQuery) SetBoost(b float64)
- func (q *GeoBoundingPolygonQuery) SetField(f string)
- func (q *GeoBoundingPolygonQuery) UnmarshalJSON(data []byte) error
- func (q *GeoBoundingPolygonQuery) Validate() error
- type GeoDistanceQuery
- func (q *GeoDistanceQuery) Boost() float64
- func (q *GeoDistanceQuery) Field() string
- func (q *GeoDistanceQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *GeoDistanceQuery) SetBoost(b float64)
- func (q *GeoDistanceQuery) SetField(f string)
- func (q *GeoDistanceQuery) UnmarshalJSON(data []byte) error
- func (q *GeoDistanceQuery) Validate() error
- type GeoShapeQuery
- func NewGeoShapeCircleQuery(coordinates []float64, radius, relation string) (*GeoShapeQuery, error)
- func NewGeoShapeQuery(coordinates [][][][]float64, typ, relation string) (*GeoShapeQuery, error)
- func NewGeometryCollectionQuery(coordinates [][][][][]float64, types []string, relation string) (*GeoShapeQuery, error)
- func (q *GeoShapeQuery) Boost() float64
- func (q *GeoShapeQuery) Field() string
- func (q *GeoShapeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *GeoShapeQuery) SetBoost(b float64)
- func (q *GeoShapeQuery) SetField(f string)
- func (q *GeoShapeQuery) Validate() error
- type Geometry
- type IPRangeQuery
- func (q *IPRangeQuery) Boost() float64
- func (q *IPRangeQuery) Field() string
- func (q *IPRangeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *IPRangeQuery) SetBoost(b float64)
- func (q *IPRangeQuery) SetField(f string)
- func (q *IPRangeQuery) Validate() error
- type MatchAllQuery
- type MatchNoneQuery
- type MatchPhraseQuery
- func (q *MatchPhraseQuery) Boost() float64
- func (q *MatchPhraseQuery) Field() string
- func (q *MatchPhraseQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *MatchPhraseQuery) SetBoost(b float64)
- func (q *MatchPhraseQuery) SetField(f string)
- type MatchQuery
- func (q *MatchQuery) Boost() float64
- func (q *MatchQuery) Field() string
- func (q *MatchQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *MatchQuery) SetBoost(b float64)
- func (q *MatchQuery) SetField(f string)
- func (q *MatchQuery) SetFuzziness(f int)
- func (q *MatchQuery) SetOperator(operator MatchQueryOperator)
- func (q *MatchQuery) SetPrefix(p int)
- type MatchQueryOperator
- type MultiPhraseQuery
- func (q *MultiPhraseQuery) Boost() float64
- func (q *MultiPhraseQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *MultiPhraseQuery) SetBoost(b float64)
- func (q *MultiPhraseQuery) UnmarshalJSON(data []byte) error
- func (q *MultiPhraseQuery) Validate() error
- type NumericRangeQuery
- func (q *NumericRangeQuery) Boost() float64
- func (q *NumericRangeQuery) Field() string
- func (q *NumericRangeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *NumericRangeQuery) SetBoost(b float64)
- func (q *NumericRangeQuery) SetField(f string)
- func (q *NumericRangeQuery) Validate() error
- type PhraseQuery
- func (q *PhraseQuery) Boost() float64
- func (q *PhraseQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *PhraseQuery) SetBoost(b float64)
- func (q *PhraseQuery) UnmarshalJSON(data []byte) error
- func (q *PhraseQuery) Validate() error
- type PrefixQuery
- type Query
- type QueryStringQuery
- func (q *QueryStringQuery) Boost() float64
- func (q *QueryStringQuery) Parse() (Query, error)
- func (q *QueryStringQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *QueryStringQuery) SetBoost(b float64)
- func (q *QueryStringQuery) Validate() error
- type RegexpQuery
- func (q *RegexpQuery) Boost() float64
- func (q *RegexpQuery) Field() string
- func (q *RegexpQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *RegexpQuery) SetBoost(b float64)
- func (q *RegexpQuery) SetField(f string)
- func (q *RegexpQuery) Validate() error
- type TermQuery
- type TermRangeQuery
- func (q *TermRangeQuery) Boost() float64
- func (q *TermRangeQuery) Field() string
- func (q *TermRangeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *TermRangeQuery) SetBoost(b float64)
- func (q *TermRangeQuery) SetField(f string)
- func (q *TermRangeQuery) Validate() error
- type ValidatableQuery
- type WildcardQuery
- func (q *WildcardQuery) Boost() float64
- func (q *WildcardQuery) Field() string
- func (q *WildcardQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, ...) (search.Searcher, error)
- func (q *WildcardQuery) SetBoost(b float64)
- func (q *WildcardQuery) SetField(f string)
- func (q *WildcardQuery) Validate() error
Constants ¶
const ( // Document must satisfy AT LEAST ONE of term searches. MatchQueryOperatorOr = MatchQueryOperator(0) // Document must satisfy ALL of term searches. MatchQueryOperatorAnd = MatchQueryOperator(1) )
Variables ¶
var MaxRFC3339CompatibleTime time.Time
var MinRFC3339CompatibleTime time.Time
var QueryDateTimeFormat = time.RFC3339
QueryDateTimeFormat controls the format when Marshaling to JSON
var QueryDateTimeParser = optional.Name
QueryDateTimeParser controls the default query date time parser
Functions ¶
Types ¶
type BleveQueryTime ¶
func (*BleveQueryTime) MarshalJSON ¶
func (t *BleveQueryTime) MarshalJSON() ([]byte, error)
func (*BleveQueryTime) UnmarshalJSON ¶
func (t *BleveQueryTime) UnmarshalJSON(data []byte) error
type BoolFieldQuery ¶
type BoolFieldQuery struct { Bool bool `json:"bool"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewBoolFieldQuery ¶
func NewBoolFieldQuery(val bool) *BoolFieldQuery
NewBoolFieldQuery creates a new Query for boolean fields
func (*BoolFieldQuery) Boost ¶
func (q *BoolFieldQuery) Boost() float64
func (*BoolFieldQuery) Field ¶
func (q *BoolFieldQuery) Field() string
func (*BoolFieldQuery) Searcher ¶
func (q *BoolFieldQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*BoolFieldQuery) SetBoost ¶
func (q *BoolFieldQuery) SetBoost(b float64)
func (*BoolFieldQuery) SetField ¶
func (q *BoolFieldQuery) SetField(f string)
type BooleanQuery ¶
type BooleanQuery struct { Must Query `json:"must,omitempty"` Should Query `json:"should,omitempty"` MustNot Query `json:"must_not,omitempty"` BoostVal *Boost `json:"boost,omitempty"` // contains filtered or unexported fields }
func NewBooleanQuery ¶
func NewBooleanQuery(must []Query, should []Query, mustNot []Query) *BooleanQuery
NewBooleanQuery creates a compound Query composed of several other Query objects. Result documents must satisfy ALL of the must Queries. Result documents must satisfy NONE of the must not Queries. Result documents that ALSO satisfy any of the should Queries will score higher.
func NewBooleanQueryForQueryString ¶
func NewBooleanQueryForQueryString(must []Query, should []Query, mustNot []Query) *BooleanQuery
func (*BooleanQuery) AddMust ¶
func (q *BooleanQuery) AddMust(m ...Query)
func (*BooleanQuery) AddMustNot ¶
func (q *BooleanQuery) AddMustNot(m ...Query)
func (*BooleanQuery) AddShould ¶
func (q *BooleanQuery) AddShould(m ...Query)
func (*BooleanQuery) Boost ¶
func (q *BooleanQuery) Boost() float64
func (*BooleanQuery) Searcher ¶
func (q *BooleanQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*BooleanQuery) SetBoost ¶
func (q *BooleanQuery) SetBoost(b float64)
func (*BooleanQuery) SetMinShould ¶
func (q *BooleanQuery) SetMinShould(minShould float64)
SetMinShould requires that at least minShould of the should Queries must be satisfied.
func (*BooleanQuery) UnmarshalJSON ¶
func (q *BooleanQuery) UnmarshalJSON(data []byte) error
func (*BooleanQuery) Validate ¶
func (q *BooleanQuery) Validate() error
type BoostableQuery ¶
A BoostableQuery represents a Query which can be boosted relative to other queries.
type ConjunctionQuery ¶
type ConjunctionQuery struct { Conjuncts []Query `json:"conjuncts"` BoostVal *Boost `json:"boost,omitempty"` // contains filtered or unexported fields }
func NewConjunctionQuery ¶
func NewConjunctionQuery(conjuncts []Query) *ConjunctionQuery
NewConjunctionQuery creates a new compound Query. Result documents must satisfy all of the queries.
func (*ConjunctionQuery) AddQuery ¶
func (q *ConjunctionQuery) AddQuery(aq ...Query)
func (*ConjunctionQuery) Boost ¶
func (q *ConjunctionQuery) Boost() float64
func (*ConjunctionQuery) Searcher ¶
func (q *ConjunctionQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*ConjunctionQuery) SetBoost ¶
func (q *ConjunctionQuery) SetBoost(b float64)
func (*ConjunctionQuery) UnmarshalJSON ¶
func (q *ConjunctionQuery) UnmarshalJSON(data []byte) error
func (*ConjunctionQuery) Validate ¶
func (q *ConjunctionQuery) Validate() error
type DateRangeQuery ¶
type DateRangeQuery struct { Start BleveQueryTime `json:"start,omitempty"` End BleveQueryTime `json:"end,omitempty"` InclusiveStart *bool `json:"inclusive_start,omitempty"` InclusiveEnd *bool `json:"inclusive_end,omitempty"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewDateRangeInclusiveQuery ¶
func NewDateRangeInclusiveQuery(start, end time.Time, startInclusive, endInclusive *bool) *DateRangeQuery
NewDateRangeInclusiveQuery creates a new Query for ranges of date values. Date strings are parsed using the DateTimeParser configured in the
top-level config.QueryDateTimeParser
Either, but not both endpoints can be nil. startInclusive and endInclusive control inclusion of the endpoints.
func NewDateRangeQuery ¶
func NewDateRangeQuery(start, end time.Time) *DateRangeQuery
NewDateRangeQuery creates a new Query for ranges of date values. Date strings are parsed using the DateTimeParser configured in the
top-level config.QueryDateTimeParser
Either, but not both endpoints can be nil.
func (*DateRangeQuery) Boost ¶
func (q *DateRangeQuery) Boost() float64
func (*DateRangeQuery) Field ¶
func (q *DateRangeQuery) Field() string
func (*DateRangeQuery) Searcher ¶
func (q *DateRangeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*DateRangeQuery) SetBoost ¶
func (q *DateRangeQuery) SetBoost(b float64)
func (*DateRangeQuery) SetField ¶
func (q *DateRangeQuery) SetField(f string)
func (*DateRangeQuery) Validate ¶
func (q *DateRangeQuery) Validate() error
type DisjunctionQuery ¶
type DisjunctionQuery struct { Disjuncts []Query `json:"disjuncts"` BoostVal *Boost `json:"boost,omitempty"` Min float64 `json:"min"` // contains filtered or unexported fields }
func NewDisjunctionQuery ¶
func NewDisjunctionQuery(disjuncts []Query) *DisjunctionQuery
NewDisjunctionQuery creates a new compound Query. Result documents satisfy at least one Query.
func (*DisjunctionQuery) AddQuery ¶
func (q *DisjunctionQuery) AddQuery(aq ...Query)
func (*DisjunctionQuery) Boost ¶
func (q *DisjunctionQuery) Boost() float64
func (*DisjunctionQuery) Searcher ¶
func (q *DisjunctionQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*DisjunctionQuery) SetBoost ¶
func (q *DisjunctionQuery) SetBoost(b float64)
func (*DisjunctionQuery) SetMin ¶
func (q *DisjunctionQuery) SetMin(m float64)
func (*DisjunctionQuery) UnmarshalJSON ¶
func (q *DisjunctionQuery) UnmarshalJSON(data []byte) error
func (*DisjunctionQuery) Validate ¶
func (q *DisjunctionQuery) Validate() error
type DocIDQuery ¶
func NewDocIDQuery ¶
func NewDocIDQuery(ids []string) *DocIDQuery
NewDocIDQuery creates a new Query object returning indexed documents among the specified set. Combine it with ConjunctionQuery to restrict the scope of other queries output.
func (*DocIDQuery) Boost ¶
func (q *DocIDQuery) Boost() float64
func (*DocIDQuery) Searcher ¶
func (q *DocIDQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*DocIDQuery) SetBoost ¶
func (q *DocIDQuery) SetBoost(b float64)
type FieldableQuery ¶
A FieldableQuery represents a Query which can be restricted to a single field.
type FuzzyQuery ¶
type FuzzyQuery struct { Term string `json:"term"` Prefix int `json:"prefix_length"` Fuzziness int `json:"fuzziness"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewFuzzyQuery ¶
func NewFuzzyQuery(term string) *FuzzyQuery
NewFuzzyQuery creates a new Query which finds documents containing terms within a specific fuzziness of the specified term. The default fuzziness is 1.
The current implementation uses Levenshtein edit distance as the fuzziness metric.
func (*FuzzyQuery) Boost ¶
func (q *FuzzyQuery) Boost() float64
func (*FuzzyQuery) Field ¶
func (q *FuzzyQuery) Field() string
func (*FuzzyQuery) Searcher ¶
func (q *FuzzyQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*FuzzyQuery) SetBoost ¶
func (q *FuzzyQuery) SetBoost(b float64)
func (*FuzzyQuery) SetField ¶
func (q *FuzzyQuery) SetField(f string)
func (*FuzzyQuery) SetFuzziness ¶
func (q *FuzzyQuery) SetFuzziness(f int)
func (*FuzzyQuery) SetPrefix ¶
func (q *FuzzyQuery) SetPrefix(p int)
type GeoBoundingBoxQuery ¶
type GeoBoundingBoxQuery struct { TopLeft []float64 `json:"top_left,omitempty"` BottomRight []float64 `json:"bottom_right,omitempty"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewGeoBoundingBoxQuery ¶
func NewGeoBoundingBoxQuery(topLeftLon, topLeftLat, bottomRightLon, bottomRightLat float64) *GeoBoundingBoxQuery
func (*GeoBoundingBoxQuery) Boost ¶
func (q *GeoBoundingBoxQuery) Boost() float64
func (*GeoBoundingBoxQuery) Field ¶
func (q *GeoBoundingBoxQuery) Field() string
func (*GeoBoundingBoxQuery) Searcher ¶
func (q *GeoBoundingBoxQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*GeoBoundingBoxQuery) SetBoost ¶
func (q *GeoBoundingBoxQuery) SetBoost(b float64)
func (*GeoBoundingBoxQuery) SetField ¶
func (q *GeoBoundingBoxQuery) SetField(f string)
func (*GeoBoundingBoxQuery) UnmarshalJSON ¶
func (q *GeoBoundingBoxQuery) UnmarshalJSON(data []byte) error
func (*GeoBoundingBoxQuery) Validate ¶
func (q *GeoBoundingBoxQuery) Validate() error
type GeoBoundingPolygonQuery ¶
type GeoBoundingPolygonQuery struct { Points []geo.Point `json:"polygon_points"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewGeoBoundingPolygonQuery ¶
func NewGeoBoundingPolygonQuery(points []geo.Point) *GeoBoundingPolygonQuery
func (*GeoBoundingPolygonQuery) Boost ¶
func (q *GeoBoundingPolygonQuery) Boost() float64
func (*GeoBoundingPolygonQuery) Field ¶
func (q *GeoBoundingPolygonQuery) Field() string
func (*GeoBoundingPolygonQuery) Searcher ¶
func (q *GeoBoundingPolygonQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*GeoBoundingPolygonQuery) SetBoost ¶
func (q *GeoBoundingPolygonQuery) SetBoost(b float64)
func (*GeoBoundingPolygonQuery) SetField ¶
func (q *GeoBoundingPolygonQuery) SetField(f string)
func (*GeoBoundingPolygonQuery) UnmarshalJSON ¶
func (q *GeoBoundingPolygonQuery) UnmarshalJSON(data []byte) error
func (*GeoBoundingPolygonQuery) Validate ¶
func (q *GeoBoundingPolygonQuery) Validate() error
type GeoDistanceQuery ¶
type GeoDistanceQuery struct { Location []float64 `json:"location,omitempty"` Distance string `json:"distance,omitempty"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewGeoDistanceQuery ¶
func NewGeoDistanceQuery(lon, lat float64, distance string) *GeoDistanceQuery
func (*GeoDistanceQuery) Boost ¶
func (q *GeoDistanceQuery) Boost() float64
func (*GeoDistanceQuery) Field ¶
func (q *GeoDistanceQuery) Field() string
func (*GeoDistanceQuery) Searcher ¶
func (q *GeoDistanceQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*GeoDistanceQuery) SetBoost ¶
func (q *GeoDistanceQuery) SetBoost(b float64)
func (*GeoDistanceQuery) SetField ¶
func (q *GeoDistanceQuery) SetField(f string)
func (*GeoDistanceQuery) UnmarshalJSON ¶
func (q *GeoDistanceQuery) UnmarshalJSON(data []byte) error
func (*GeoDistanceQuery) Validate ¶
func (q *GeoDistanceQuery) Validate() error
type GeoShapeQuery ¶ added in v2.3.3
type GeoShapeQuery struct { Geometry Geometry `json:"geometry"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewGeoShapeCircleQuery ¶ added in v2.3.3
func NewGeoShapeCircleQuery(coordinates []float64, radius, relation string) (*GeoShapeQuery, error)
NewGeoShapeCircleQuery creates a geoshape query for the given center point and the radius. Radius formats supported: "5in" "5inch" "7yd" "7yards" "9ft" "9feet" "11km" "11kilometers" "3nm" "3nauticalmiles" "13mm" "13millimeters" "15cm" "15centimeters" "17mi" "17miles" "19m" "19meters" If the unit cannot be determined, the entire string is parsed and the unit of meters is assumed.
func NewGeoShapeQuery ¶ added in v2.3.3
func NewGeoShapeQuery(coordinates [][][][]float64, typ, relation string) (*GeoShapeQuery, error)
NewGeoShapeQuery creates a geoshape query for the given shape type. This method can be used for creating geoshape queries for shape types like: point, linestring, polygon, multipoint, multilinestring, multipolygon and envelope.
func NewGeometryCollectionQuery ¶ added in v2.3.3
func NewGeometryCollectionQuery(coordinates [][][][][]float64, types []string, relation string) (*GeoShapeQuery, error)
NewGeometryCollectionQuery creates a geoshape query for the given geometrycollection coordinates and types.
func (*GeoShapeQuery) Boost ¶ added in v2.3.3
func (q *GeoShapeQuery) Boost() float64
func (*GeoShapeQuery) Field ¶ added in v2.3.3
func (q *GeoShapeQuery) Field() string
func (*GeoShapeQuery) Searcher ¶ added in v2.3.3
func (q *GeoShapeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*GeoShapeQuery) SetBoost ¶ added in v2.3.3
func (q *GeoShapeQuery) SetBoost(b float64)
func (*GeoShapeQuery) SetField ¶ added in v2.3.3
func (q *GeoShapeQuery) SetField(f string)
func (*GeoShapeQuery) Validate ¶ added in v2.3.3
func (q *GeoShapeQuery) Validate() error
type Geometry ¶ added in v2.3.3
func (*Geometry) UnmarshalJSON ¶ added in v2.3.3
type IPRangeQuery ¶ added in v2.3.0
type IPRangeQuery struct { CIDR string `json:"cidr, omitempty"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewIPRangeQuery ¶ added in v2.3.0
func NewIPRangeQuery(cidr string) *IPRangeQuery
func (*IPRangeQuery) Boost ¶ added in v2.3.0
func (q *IPRangeQuery) Boost() float64
func (*IPRangeQuery) Field ¶ added in v2.3.0
func (q *IPRangeQuery) Field() string
func (*IPRangeQuery) Searcher ¶ added in v2.3.0
func (q *IPRangeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*IPRangeQuery) SetBoost ¶ added in v2.3.0
func (q *IPRangeQuery) SetBoost(b float64)
func (*IPRangeQuery) SetField ¶ added in v2.3.0
func (q *IPRangeQuery) SetField(f string)
func (*IPRangeQuery) Validate ¶ added in v2.3.0
func (q *IPRangeQuery) Validate() error
type MatchAllQuery ¶
type MatchAllQuery struct {
BoostVal *Boost `json:"boost,omitempty"`
}
func NewMatchAllQuery ¶
func NewMatchAllQuery() *MatchAllQuery
NewMatchAllQuery creates a Query which will match all documents in the index.
func (*MatchAllQuery) Boost ¶
func (q *MatchAllQuery) Boost() float64
func (*MatchAllQuery) MarshalJSON ¶
func (q *MatchAllQuery) MarshalJSON() ([]byte, error)
func (*MatchAllQuery) Searcher ¶
func (q *MatchAllQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*MatchAllQuery) SetBoost ¶
func (q *MatchAllQuery) SetBoost(b float64)
type MatchNoneQuery ¶
type MatchNoneQuery struct {
BoostVal *Boost `json:"boost,omitempty"`
}
func NewMatchNoneQuery ¶
func NewMatchNoneQuery() *MatchNoneQuery
NewMatchNoneQuery creates a Query which will not match any documents in the index.
func (*MatchNoneQuery) Boost ¶
func (q *MatchNoneQuery) Boost() float64
func (*MatchNoneQuery) MarshalJSON ¶
func (q *MatchNoneQuery) MarshalJSON() ([]byte, error)
func (*MatchNoneQuery) Searcher ¶
func (q *MatchNoneQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*MatchNoneQuery) SetBoost ¶
func (q *MatchNoneQuery) SetBoost(b float64)
type MatchPhraseQuery ¶
type MatchPhraseQuery struct { MatchPhrase string `json:"match_phrase"` FieldVal string `json:"field,omitempty"` Analyzer string `json:"analyzer,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewMatchPhraseQuery ¶
func NewMatchPhraseQuery(matchPhrase string) *MatchPhraseQuery
NewMatchPhraseQuery creates a new Query object for matching phrases in the index. An Analyzer is chosen based on the field. Input text is analyzed using this analyzer. Token terms resulting from this analysis are used to build a search phrase. Result documents must match this phrase. Queried field must have been indexed with IncludeTermVectors set to true.
func (*MatchPhraseQuery) Boost ¶
func (q *MatchPhraseQuery) Boost() float64
func (*MatchPhraseQuery) Field ¶
func (q *MatchPhraseQuery) Field() string
func (*MatchPhraseQuery) Searcher ¶
func (q *MatchPhraseQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*MatchPhraseQuery) SetBoost ¶
func (q *MatchPhraseQuery) SetBoost(b float64)
func (*MatchPhraseQuery) SetField ¶
func (q *MatchPhraseQuery) SetField(f string)
type MatchQuery ¶
type MatchQuery struct { Match string `json:"match"` FieldVal string `json:"field,omitempty"` Analyzer string `json:"analyzer,omitempty"` BoostVal *Boost `json:"boost,omitempty"` Prefix int `json:"prefix_length"` Fuzziness int `json:"fuzziness"` Operator MatchQueryOperator `json:"operator,omitempty"` }
func NewMatchQuery ¶
func NewMatchQuery(match string) *MatchQuery
NewMatchQuery creates a Query for matching text. An Analyzer is chosen based on the field. Input text is analyzed using this analyzer. Token terms resulting from this analysis are used to perform term searches. Result documents must satisfy at least one of these term searches.
func (*MatchQuery) Boost ¶
func (q *MatchQuery) Boost() float64
func (*MatchQuery) Field ¶
func (q *MatchQuery) Field() string
func (*MatchQuery) Searcher ¶
func (q *MatchQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*MatchQuery) SetBoost ¶
func (q *MatchQuery) SetBoost(b float64)
func (*MatchQuery) SetField ¶
func (q *MatchQuery) SetField(f string)
func (*MatchQuery) SetFuzziness ¶
func (q *MatchQuery) SetFuzziness(f int)
func (*MatchQuery) SetOperator ¶
func (q *MatchQuery) SetOperator(operator MatchQueryOperator)
func (*MatchQuery) SetPrefix ¶
func (q *MatchQuery) SetPrefix(p int)
type MatchQueryOperator ¶
type MatchQueryOperator int
func (MatchQueryOperator) MarshalJSON ¶
func (o MatchQueryOperator) MarshalJSON() ([]byte, error)
func (*MatchQueryOperator) UnmarshalJSON ¶
func (o *MatchQueryOperator) UnmarshalJSON(data []byte) error
type MultiPhraseQuery ¶
type MultiPhraseQuery struct { Terms [][]string `json:"terms"` Field string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewMultiPhraseQuery ¶
func NewMultiPhraseQuery(terms [][]string, field string) *MultiPhraseQuery
NewMultiPhraseQuery creates a new Query for finding term phrases in the index. It is like PhraseQuery, but each position in the phrase may be satisfied by a list of terms as opposed to just one. At least one of the terms must exist in the correct order, at the correct index offsets, in the specified field. Queried field must have been indexed with IncludeTermVectors set to true.
func (*MultiPhraseQuery) Boost ¶
func (q *MultiPhraseQuery) Boost() float64
func (*MultiPhraseQuery) Searcher ¶
func (q *MultiPhraseQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*MultiPhraseQuery) SetBoost ¶
func (q *MultiPhraseQuery) SetBoost(b float64)
func (*MultiPhraseQuery) UnmarshalJSON ¶
func (q *MultiPhraseQuery) UnmarshalJSON(data []byte) error
func (*MultiPhraseQuery) Validate ¶
func (q *MultiPhraseQuery) Validate() error
type NumericRangeQuery ¶
type NumericRangeQuery struct { Min *float64 `json:"min,omitempty"` Max *float64 `json:"max,omitempty"` InclusiveMin *bool `json:"inclusive_min,omitempty"` InclusiveMax *bool `json:"inclusive_max,omitempty"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewNumericRangeInclusiveQuery ¶
func NewNumericRangeInclusiveQuery(min, max *float64, minInclusive, maxInclusive *bool) *NumericRangeQuery
NewNumericRangeInclusiveQuery creates a new Query for ranges of numeric values. Either, but not both endpoints can be nil. Control endpoint inclusion with inclusiveMin, inclusiveMax.
func NewNumericRangeQuery ¶
func NewNumericRangeQuery(min, max *float64) *NumericRangeQuery
NewNumericRangeQuery creates a new Query for ranges of numeric values. Either, but not both endpoints can be nil. The minimum value is inclusive. The maximum value is exclusive.
func (*NumericRangeQuery) Boost ¶
func (q *NumericRangeQuery) Boost() float64
func (*NumericRangeQuery) Field ¶
func (q *NumericRangeQuery) Field() string
func (*NumericRangeQuery) Searcher ¶
func (q *NumericRangeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*NumericRangeQuery) SetBoost ¶
func (q *NumericRangeQuery) SetBoost(b float64)
func (*NumericRangeQuery) SetField ¶
func (q *NumericRangeQuery) SetField(f string)
func (*NumericRangeQuery) Validate ¶
func (q *NumericRangeQuery) Validate() error
type PhraseQuery ¶
type PhraseQuery struct { Terms []string `json:"terms"` Field string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewPhraseQuery ¶
func NewPhraseQuery(terms []string, field string) *PhraseQuery
NewPhraseQuery creates a new Query for finding exact term phrases in the index. The provided terms must exist in the correct order, at the correct index offsets, in the specified field. Queried field must have been indexed with IncludeTermVectors set to true.
func (*PhraseQuery) Boost ¶
func (q *PhraseQuery) Boost() float64
func (*PhraseQuery) Searcher ¶
func (q *PhraseQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*PhraseQuery) SetBoost ¶
func (q *PhraseQuery) SetBoost(b float64)
func (*PhraseQuery) UnmarshalJSON ¶
func (q *PhraseQuery) UnmarshalJSON(data []byte) error
func (*PhraseQuery) Validate ¶
func (q *PhraseQuery) Validate() error
type PrefixQuery ¶
type PrefixQuery struct { Prefix string `json:"prefix"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewPrefixQuery ¶
func NewPrefixQuery(prefix string) *PrefixQuery
NewPrefixQuery creates a new Query which finds documents containing terms that start with the specified prefix.
func (*PrefixQuery) Boost ¶
func (q *PrefixQuery) Boost() float64
func (*PrefixQuery) Field ¶
func (q *PrefixQuery) Field() string
func (*PrefixQuery) Searcher ¶
func (q *PrefixQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*PrefixQuery) SetBoost ¶
func (q *PrefixQuery) SetBoost(b float64)
func (*PrefixQuery) SetField ¶
func (q *PrefixQuery) SetField(f string)
type Query ¶
type Query interface { Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error) }
A Query represents a description of the type and parameters for a query into the index.
func ParseQuery ¶
ParseQuery deserializes a JSON representation of a Query object.
type QueryStringQuery ¶
type QueryStringQuery struct { Query string `json:"query"` BoostVal *Boost `json:"boost,omitempty"` }
func NewQueryStringQuery ¶
func NewQueryStringQuery(query string) *QueryStringQuery
NewQueryStringQuery creates a new Query used for finding documents that satisfy a query string. The query string is a small query language for humans.
func (*QueryStringQuery) Boost ¶
func (q *QueryStringQuery) Boost() float64
func (*QueryStringQuery) Parse ¶
func (q *QueryStringQuery) Parse() (Query, error)
func (*QueryStringQuery) Searcher ¶
func (q *QueryStringQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*QueryStringQuery) SetBoost ¶
func (q *QueryStringQuery) SetBoost(b float64)
func (*QueryStringQuery) Validate ¶
func (q *QueryStringQuery) Validate() error
type RegexpQuery ¶
type RegexpQuery struct { Regexp string `json:"regexp"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewRegexpQuery ¶
func NewRegexpQuery(regexp string) *RegexpQuery
NewRegexpQuery creates a new Query which finds documents containing terms that match the specified regular expression. The regexp pattern SHOULD NOT include ^ or $ modifiers, the search will only match entire terms even without them.
func (*RegexpQuery) Boost ¶
func (q *RegexpQuery) Boost() float64
func (*RegexpQuery) Field ¶
func (q *RegexpQuery) Field() string
func (*RegexpQuery) Searcher ¶
func (q *RegexpQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*RegexpQuery) SetBoost ¶
func (q *RegexpQuery) SetBoost(b float64)
func (*RegexpQuery) SetField ¶
func (q *RegexpQuery) SetField(f string)
func (*RegexpQuery) Validate ¶
func (q *RegexpQuery) Validate() error
type TermQuery ¶
type TermQuery struct { Term string `json:"term"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewTermQuery ¶
NewTermQuery creates a new Query for finding an exact term match in the index.
func (*TermQuery) Searcher ¶
func (q *TermQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
type TermRangeQuery ¶
type TermRangeQuery struct { Min string `json:"min,omitempty"` Max string `json:"max,omitempty"` InclusiveMin *bool `json:"inclusive_min,omitempty"` InclusiveMax *bool `json:"inclusive_max,omitempty"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewTermRangeInclusiveQuery ¶
func NewTermRangeInclusiveQuery(min, max string, minInclusive, maxInclusive *bool) *TermRangeQuery
NewTermRangeInclusiveQuery creates a new Query for ranges of numeric values. Either, but not both endpoints can be nil. Control endpoint inclusion with inclusiveMin, inclusiveMax.
func NewTermRangeQuery ¶
func NewTermRangeQuery(min, max string) *TermRangeQuery
NewTermRangeQuery creates a new Query for ranges of text term values. Either, but not both endpoints can be nil. The minimum value is inclusive. The maximum value is exclusive.
func (*TermRangeQuery) Boost ¶
func (q *TermRangeQuery) Boost() float64
func (*TermRangeQuery) Field ¶
func (q *TermRangeQuery) Field() string
func (*TermRangeQuery) Searcher ¶
func (q *TermRangeQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*TermRangeQuery) SetBoost ¶
func (q *TermRangeQuery) SetBoost(b float64)
func (*TermRangeQuery) SetField ¶
func (q *TermRangeQuery) SetField(f string)
func (*TermRangeQuery) Validate ¶
func (q *TermRangeQuery) Validate() error
type ValidatableQuery ¶
A ValidatableQuery represents a Query which can be validated prior to execution.
type WildcardQuery ¶
type WildcardQuery struct { Wildcard string `json:"wildcard"` FieldVal string `json:"field,omitempty"` BoostVal *Boost `json:"boost,omitempty"` }
func NewWildcardQuery ¶
func NewWildcardQuery(wildcard string) *WildcardQuery
NewWildcardQuery creates a new Query which finds documents containing terms that match the specified wildcard. In the wildcard pattern '*' will match any sequence of 0 or more characters, and '?' will match any single character.
func (*WildcardQuery) Boost ¶
func (q *WildcardQuery) Boost() float64
func (*WildcardQuery) Field ¶
func (q *WildcardQuery) Field() string
func (*WildcardQuery) Searcher ¶
func (q *WildcardQuery) Searcher(ctx context.Context, i index.IndexReader, m mapping.IndexMapping, options search.SearcherOptions) (search.Searcher, error)
func (*WildcardQuery) SetBoost ¶
func (q *WildcardQuery) SetBoost(b float64)
func (*WildcardQuery) SetField ¶
func (q *WildcardQuery) SetField(f string)
func (*WildcardQuery) Validate ¶
func (q *WildcardQuery) Validate() error
Source Files ¶
- bool_field.go
- boolean.go
- boost.go
- conjunction.go
- date_range.go
- disjunction.go
- docid.go
- fuzzy.go
- geo_boundingbox.go
- geo_boundingpolygon.go
- geo_distance.go
- geo_shape.go
- ip_range.go
- match.go
- match_all.go
- match_none.go
- match_phrase.go
- multi_phrase.go
- numeric_range.go
- phrase.go
- prefix.go
- query.go
- query_string.go
- query_string.y
- query_string_lex.go
- query_string_parser.go
- regexp.go
- term.go
- term_range.go
- wildcard.go