bleve搜索引擎是支持基于field搜索的

简介:

Query String Query

The query language query allows humans to describe complex queries using a simple syntax.

Terms

Plain terms without any other syntax are interpreted as a match query for the term in the default field. The default field is _allunless overridden in the index mapping.

Example: water will perform a Match Query for the term water.

Phrases

Phrase queries can be accomplished by placing the phrase in quotes.

Example: "light beer" will peform a Match Phrase Query for the phrase light beer.

Field Scoping

You can qualify the field for these searches by prefixing them with the name of the field separated by a colon.

Example: description:water will perform a Match Query for the term water, in the description field.

Required, Optional, and Exclusion

When your query string includes multiple items, by default these are placed into the SHOULD clause of a Boolean Query.

You can change this by prefixing your items with a + or ‘-’. * ‘+’ Prefixing with plus places that item in the MUST portion of the boolean query. * ‘-’ Prefixing with a minus places that item in the MUST NOT portion of the boolean query.

Example: +description:water -light beer will perform a Boolean Query that MUST satisfy the Match Query for the term waterin the description field, MUST NOT satisfy the Match Query for the term light in the default field, and SHOULD satisfy the Match Query for the term beer in the default field. Result documents satisfying the SHOULD clause will score higher than those that do not.

Boosting

You can influence the relative importance of the clauses by suffixing clauses with the ^ operator followed by a number.

Example: description:water name:water^5 will perform Match queries for water in both the name and description fields, but documents having the term in the name field will score higher.

Numeric Ranges

You can perform numeric ranges by using the >, >=, <, and <= operators, followed by a numeric value.

Example: abv:>10 will perform an Numeric Range Query on the abv field for values greater than ten.

Date Ranges

You can perform date range searches by using the >, >=, <, and <= operators, followed by a date value in quotes.

Example: created:>"2016-09-21" will perform an Date Range Query on the created field for values after September 21, 2016.

Escaping

The following quoted string enumerates the characters which may be escaped:

"+-=&|><!(){}[]^\"~*?:\\/ "

NOTE: this list contains the space character.

In order to escape these characters, they are prefixed with the \ (backslash) character. In all cases, using the escaped version produces the character itself and is not interpreted by the lexer.

Example: my\ name will be interpreted as a single argument to a match query with the value “my name”.

Example: "contains a\" character" will be interpreted as a single argument to a phrase query with the value contains a " character.















本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/6495488.html,如需转载请自行联系原作者

相关文章
|
自然语言处理 算法 搜索推荐
给全文搜索引擎Manticore (Sphinx) search 增加中文分词
Sphinx search 是一款非常棒的开源全文搜索引擎,它使用C++开发,索引和搜索的速度非常快,我使用sphinx的时间也有好多年了。最初使用的是coreseek,一个国人在sphinxsearch基础上添加了mmseg分词的搜索引擎,可惜后来不再更新,sphinxsearch的版本太低,bug也会出现;后来也使用最新的sphinxsearch,它可以支持几乎所有语言,通过其内置的ngram tokenizer对中文进行索引和搜索。
4083 0
|
XML JSON 缓存
如何获得JD搜索关键词推荐列表?
如何获得JD搜索关键词推荐列表?
|
SQL Java
白话Elasticsearch04- 结构化搜索之使用terms query搜索多个值以及多值搜索结果优化
白话Elasticsearch04- 结构化搜索之使用terms query搜索多个值以及多值搜索结果优化
526 0
|
SQL JSON 自然语言处理
白话Elasticsearch01- 结构化搜索之使用term query来搜索数据
白话Elasticsearch01- 结构化搜索之使用term query来搜索数据
301 0
|
SQL
白话Elasticsearch05- 结构化搜索之使用range query来进行范围过滤
白话Elasticsearch05- 结构化搜索之使用range query来进行范围过滤
120 0
|
分布式计算 自然语言处理 Java
白话Elasticsearch17-深度探秘搜索技术之match_phrase query 短语匹配搜索
白话Elasticsearch17-深度探秘搜索技术之match_phrase query 短语匹配搜索
118 0
|
SQL 索引
白话Elasticsearch03- 结构化搜索之基于bool组合多个filter条件来搜索数据
白话Elasticsearch03- 结构化搜索之基于bool组合多个filter条件来搜索数据
301 0
一日一技:在ES中如何使用通配符搜索keyword字段
一日一技:在ES中如何使用通配符搜索keyword字段
297 0
|
JavaScript 前端开发 API
全文检索与高亮关键词匹配,用replace就够了
全文关键词检索高亮,这个在业务中常有的功能,比如浏览器默认就有个功能,关键词搜索就会匹配你检索的文字,并且会给你高亮,这是怎么实现的呢?
308 0
全文检索与高亮关键词匹配,用replace就够了
|
自然语言处理 索引
solr长文本搜索问题
假期重新把之前在新浪博客里面的文字梳理了下,搬到这里
280 0
下一篇
无影云桌面