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 _all
unless 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 water
in 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
.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」