Skip to content

Commit 96a87a3

Browse files
richardwei2008medcl
authored andcommitted
chapter13_part5: /100_Full_Text_Search/20_How_match_uses_bool.asciidoc (#79)
* chapter13_part5: /100_Full_Text_Search/20_How_match_uses_bool.asciidoc 初译 * improve file name tag
1 parent d1eaa03 commit 96a87a3

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

100_Full_Text_Search/20_How_match_uses_bool.asciidoc

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
=== How match Uses bool
1+
[[_how_match_uses_bool]]
2+
=== 如何使用布尔匹配
23

3-
By now, you have probably realized that <<match-multi-word,multiword `match`
4-
queries>> simply wrap((("match query", "use of bool query in multi-word searches")))((("bool query", "use by match query in multi-word searches")))((("full text search", "how match query uses bool query"))) the generated `term` queries in a `bool` query. With the
5-
default `or` operator, each `term` query is added as a `should` clause, so
6-
at least one clause must match. These two queries are equivalent:
4+
目前为止,可能已经意识到<<match-multi-word,多词 `match` 查询>>只是简单地将生成的 `term` 查询包裹((("match query", "use of bool query in multi-word searches")))((("bool query", "use by match query in multi-word searches")))((("full text search", "how match query uses bool query")))在一个 `bool` 查询中。如果使用默认的 `or` 操作符,每个 `term` 查询都被当作 `should` 语句,这样就要求必须至少匹配一条语句。以下两个查询是等价的:
75

86
[source,js]
97
--------------------------------------------------
@@ -24,8 +22,7 @@ at least one clause must match. These two queries are equivalent:
2422
}
2523
--------------------------------------------------
2624

27-
With the `and` operator, all the `term` queries are added as `must` clauses,
28-
so _all_ clauses must match. These two queries are equivalent:
25+
如果使用 `and` 操作符,所有的 `term` 查询都被当作 `must` 语句,所以 _所有(all)_ 语句都必须匹配。以下两个查询是等价的:
2926

3027
[source,js]
3128
--------------------------------------------------
@@ -51,8 +48,7 @@ so _all_ clauses must match. These two queries are equivalent:
5148
}
5249
--------------------------------------------------
5350

54-
And if the `minimum_should_match` parameter is((("minimum_should_match parameter", "match query using bool query"))) specified, it is passed
55-
directly through to the `bool` query, making these two queries equivalent:
51+
如果指定参数 `minimum_should_match` ((("minimum_should_match parameter", "match query using bool query"))),它可以通过 `bool` 查询直接传递,使以下两个查询等价:
5652

5753
[source,js]
5854
--------------------------------------------------
@@ -79,14 +75,7 @@ directly through to the `bool` query, making these two queries equivalent:
7975
}
8076
}
8177
--------------------------------------------------
82-
<1> Because there are only three clauses, the `minimum_should_match`
83-
value of `75%` in the `match` query is rounded down to `2`.
84-
At least two out of the three `should` clauses must match.
78+
<1> 因为只有三条语句,`match` 查询的参数 `minimum_should_match` 值 75% 会被截断成 `2` 。即三条 `should` 语句中至少有两条必须匹配。
8579

8680

87-
Of course, we would normally write these types of queries by using the `match`
88-
query, but understanding how the `match` query works internally lets you take
89-
control of the process when you need to. Some things can't be
90-
done with a single `match` query, such as give more weight to some query terms
91-
than to others. We will look at an example of this in the next section.
92-
81+
当然,我们通常将这些查询用 `match` 查询来表示,但是如果了解 `match` 内部的工作原理,我们就能根据自己的需要来控制查询过程。有些时候单个 `match` 查询无法满足需求,比如为某些查询条件分配更高的权重。我们会在下一小节中看到这个例子。

0 commit comments

Comments
 (0)