SOLR-14539 Ref Guide update {!bool excludeTags}

This commit is contained in:
Mikhail Khludnev 2020-06-29 00:15:36 +03:00 committed by Mikhail Khludnev
parent 6eb7bc3b7b
commit 1f6de31db8
2 changed files with 48 additions and 0 deletions

View File

@ -303,6 +303,30 @@ include::{example-source-dir}JsonRequestApiTest.java[tag=solrj-ipod-query-bool-c
====
--
Example of referencing <<Additional Queries,additional queries>>, <<Tagging in JSON Query DSL,tagging>> and <<other-parsers.adoc#boolean-query-parser,exclusions>>:
[source,bash]
----
curl -X POST http://localhost:8983/solr/techproducts/query -d '
{
"queries": {
"query_filters":[ // 1.
{"#size_tag":{"field":{"f":"size","query":"XL"}}},
{"#color_tag":{"field":{"f":"color","query":"Red"}}} // 2.
]
},
"query": {
"bool": {
"must": {"param":"query_filters"}, // refer both of 1.
"excludeTags": "color_tag" // excluding 2.
}
}
}'
----
Thus, the query above will return only docs matching `size:XL`.
== Filter Queries
The syntaxes discussed above can also be used to specify query filters (under the `filter` key) in addition to the main query itself.

View File

@ -190,6 +190,9 @@ A list of queries *should* appear in matching documents. For a BooleanQuery with
`filter`::
A list of queries that *must* appear in matching documents. However, unlike `must`, the score of filter queries is ignored. Also, these queries are cached in filter cache. To avoid caching add either `cache=false` as local parameter, or `"cache":"false"` property to underneath Query DLS Object.
`excludeTags`::
Comma separated list of tags for excluding queries from parameters above. See explanation below.
*Examples*
[source,text]
@ -202,6 +205,27 @@ A list of queries that *must* appear in matching documents. However, unlike `mus
{!bool filter=foo should=bar}
----
Parameters might also be multivalue references. The former example above is equivlent to
[source,text]
----
q={!bool must=$ref}&ref=foo&ref=bar
----
Referred queries might be excuded via tags. Overall the idea is similar to <<faceting.adoc#tagging-and-excluding-filters, excluding fq in facets>>.
[source,text]
----
q={!bool must=$ref excludeTags=t2}&ref={!tag=t1}foo&ref={!tag=t2}bar
----
Since the later query is excluded via `t2`, the resulting query is equivalent to
[source,text]
----
q={!bool must=foo}
----
== Boost Query Parser
`BoostQParser` extends the `QParserPlugin` and creates a boosted query from the input value. The main value is any query to be "wrapped" and "boosted" -- only documents which match that query will match the final query produced by this parser.