You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mk...@apache.org on 2020/07/01 12:22:34 UTC
[lucene-solr] branch branch_8x updated: SOLR-14539 Ref Guide update
{!bool excludeTags}
This is an automated email from the ASF dual-hosted git repository.
mkhl pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 1ea6202 SOLR-14539 Ref Guide update {!bool excludeTags}
1ea6202 is described below
commit 1ea62021f414039972f9e576792b835ebf67d83f
Author: Mikhail Khludnev <mk...@apache.org>
AuthorDate: Wed Jul 1 15:20:25 2020 +0300
SOLR-14539 Ref Guide update {!bool excludeTags}
---
solr/solr-ref-guide/src/json-query-dsl.adoc | 24 ++++++++++++++++++++++++
solr/solr-ref-guide/src/other-parsers.adoc | 24 ++++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/solr/solr-ref-guide/src/json-query-dsl.adoc b/solr/solr-ref-guide/src/json-query-dsl.adoc
index d15d909..a02de28 100644
--- a/solr/solr-ref-guide/src/json-query-dsl.adoc
+++ b/solr/solr-ref-guide/src/json-query-dsl.adoc
@@ -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.
diff --git a/solr/solr-ref-guide/src/other-parsers.adoc b/solr/solr-ref-guide/src/other-parsers.adoc
index e41b1d1..51f97e7 100644
--- a/solr/solr-ref-guide/src/other-parsers.adoc
+++ b/solr/solr-ref-guide/src/other-parsers.adoc
@@ -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.