You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Samuel Gutierrez <sa...@iherb.com.INVALID> on 2022/07/27 00:34:10 UTC
OR clause in json post request
I am working on a json post request where I need to mix AND and OR clauses
for example:
Condition1 AND Condition2 AND Condition3 AND Condition4 AND (Condition5 OR
Condition6)
What I have (which works correctly for filtering documents) is this:
...
"filter": [
"Condition1"
"Condition2",
"Condition3,
"Condition4",
{
"bool": {
"should": [
{
"#excf": "Condition5"
},
{
"#exhtf": "Condition6"
}
]
}
},
],
...
However it looks like the tagging portion of the OR clause is not working
as expected. Is tagging not respected when using a bool condition or is
there another way to do this?
Thanks,
Sam
--
*The information contained in this message is the sole and exclusive
property of ***iHerb Inc.*** and may be privileged and confidential. It may
not be disseminated or distributed to persons or entities other than the
ones intended without the written authority of ***iHerb Inc.** *If you have
received this e-mail in error or are not the intended recipient, you may
not use, copy, disseminate or distribute it. Do not open any attachments.
Please delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.*
Re: OR clause in json post request
Posted by Dave <ha...@gmail.com>.
Once you introduce an AND with an or condition logic starts getting funky. But hard to tell without the actual queries
> On Jul 26, 2022, at 8:34 PM, Samuel Gutierrez <sa...@iherb.com.invalid> wrote:
>
> I am working on a json post request where I need to mix AND and OR clauses
> for example:
> Condition1 AND Condition2 AND Condition3 AND Condition4 AND (Condition5 OR
> Condition6)
> What I have (which works correctly for filtering documents) is this:
> ...
> "filter": [
> "Condition1"
> "Condition2",
> "Condition3,
> "Condition4",
> {
> "bool": {
> "should": [
> {
> "#excf": "Condition5"
> },
> {
> "#exhtf": "Condition6"
> }
> ]
> }
> },
> ],
> ...
> However it looks like the tagging portion of the OR clause is not working
> as expected. Is tagging not respected when using a bool condition or is
> there another way to do this?
>
> Thanks,
> Sam
>
> --
> *The information contained in this message is the sole and exclusive
> property of ***iHerb Inc.*** and may be privileged and confidential. It may
> not be disseminated or distributed to persons or entities other than the
> ones intended without the written authority of ***iHerb Inc.** *If you have
> received this e-mail in error or are not the intended recipient, you may
> not use, copy, disseminate or distribute it. Do not open any attachments.
> Please delete it immediately from your system and notify the sender
> promptly by e-mail that you have done so.*
Re: OR clause in json post request
Posted by Mikhail Khludnev <mk...@apache.org>.
Hello, Sam.
It's hard to grasp but probably
https://solr.apache.org/guide/8_8/json-query-dsl.html#additional-queries
may do what you need.
On Wed, Jul 27, 2022 at 10:34 AM Samuel Gutierrez
<sa...@iherb.com.invalid> wrote:
> I am working on a json post request where I need to mix AND and OR clauses
> for example:
> Condition1 AND Condition2 AND Condition3 AND Condition4 AND (Condition5 OR
> Condition6)
> What I have (which works correctly for filtering documents) is this:
> ...
> "filter": [
> "Condition1"
> "Condition2",
> "Condition3,
> "Condition4",
> {
> "bool": {
> "should": [
> {
> "#excf": "Condition5"
> },
> {
> "#exhtf": "Condition6"
> }
> ]
> }
> },
> ],
> ...
> However it looks like the tagging portion of the OR clause is not working
> as expected. Is tagging not respected when using a bool condition or is
> there another way to do this?
>
> Thanks,
> Sam
>
> --
> *The information contained in this message is the sole and exclusive
> property of ***iHerb Inc.*** and may be privileged and confidential. It
> may
> not be disseminated or distributed to persons or entities other than the
> ones intended without the written authority of ***iHerb Inc.** *If you
> have
> received this e-mail in error or are not the intended recipient, you may
> not use, copy, disseminate or distribute it. Do not open any attachments.
> Please delete it immediately from your system and notify the sender
> promptly by e-mail that you have done so.*
>
--
Sincerely yours
Mikhail Khludnev