Documentation
¶
Index ¶
- Variables
- func BuildIndexMapping(defaultAnalyzer string) *mapping.IndexMappingImpl
- type ClauseFuzzy
- type ClauseMatch
- type ClausePhrase
- type ClausePrefix
- type ClauseQueryString
- type ClauseRegex
- type ClauseWildcard
- type Config
- type Doc
- type Engine
- type FacetRequest
- type FacetResult
- type FacetTerm
- type Hit
- type NumericRangeFilter
- type SearchRequest
- type SearchResult
- type TimeRangeFilter
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("search engine closed")
Functions ¶
func BuildIndexMapping ¶
func BuildIndexMapping(defaultAnalyzer string) *mapping.IndexMappingImpl
Types ¶
type ClauseFuzzy ¶
type ClauseMatch ¶
type ClauseMatch struct {
Field string
Query string
Boost *float64
Operator string // "and"/"or",默认 or
}
-------- 高级搜索子句(新增) --------
type ClausePhrase ¶
type ClausePrefix ¶
type ClauseQueryString ¶
type ClauseRegex ¶
type ClauseWildcard ¶
type Engine ¶
type Engine interface {
Index(ctx context.Context, doc Doc) error
IndexBatch(ctx context.Context, docs []Doc) error
Delete(ctx context.Context, id string) error
Search(ctx context.Context, req SearchRequest) (SearchResult, error)
Get(ctx context.Context, id string) (Hit, error)
List(ctx context.Context, from int, size int) (SearchResult, error)
GetAutoCompleteSuggestions(ctx context.Context, keyword string) ([]string, error)
GetSearchSuggestions(ctx context.Context, keyword string) ([]string, error)
Close() error
}
func NewDefault ¶
type FacetRequest ¶
Facet 聚合
type FacetResult ¶
type NumericRangeFilter ¶
type SearchRequest ¶
type SearchRequest struct {
// 关键字(保留老接口)
Keyword string
SearchFields []string
// 结构化 Term
MustTerms map[string][]string
MustNotTerms map[string][]string
ShouldTerms map[string][]string
// 数值/时间过滤
NumericRanges []NumericRangeFilter
TimeRanges []TimeRangeFilter
// 高级查询子句(新增)
QueryString *ClauseQueryString
Matches []ClauseMatch
Phrases []ClausePhrase
Prefixes []ClausePrefix
Wildcards []ClauseWildcard
Regexps []ClauseRegex
Fuzzies []ClauseFuzzy
// 布尔控制
MinShould int // 至少满足多少个 should(对 ShouldTerms + 高级 should 子句生效)
// Facet 聚合
Facets []FacetRequest
// 排序与分页
SortBy []string
From int
Size int
// 字段返回与高亮
IncludeFields []string
Highlight bool
HighlightFields []string // 指定需要高亮的字段,默认全部 text 字段
FragmentSize int // 片段长度
MaxFragments int // 每字段片段数
}
type SearchResult ¶
Click to show internal directories.
Click to hide internal directories.