“How come edisMax parses *:* as doc_text_value…” This is arguably a bug, especially because it works as you’d expect if you put a space after the paren, i.e. ( *:*…
“Does it work the same if I use this clause in q” yes. I know it’s weird, but use some_field:[* TO *] Best, Erick > On Sep 14, 2020, at 5:13 AM, Iana Bondarska <yana2...@gmail.com> wrote: > > Hi Erick, > thanks for the response! > I've checked parsed queries in debug mode and there is following > difference: > > original query(this is value of the q parameter in the query) > : (some_field:"hourly") AND (*:* AND -field_to_exclude:*) > > for edismax defType: > (+(+(+some_field:hourly) +(+DisjunctionMaxQuery((doc_text_value:*\\:*)) > -field_to_exclude:*)))/no_coord > > > for default defType: > > > +(+some_field:hourly) +(+MatchAllDocsQuery(*:*) -field_to_exclude:*) > defType: > > > How comes that edisMax defType parses *:* query as (doc_text_value:*\\:*)? > What should I use instead? > > > Also you've mentioned that field_to_exclude:* is inefficient when use in > fq. Does it work the same if I use this clause in q? > > > On Fri, Sep 11, 2020 at 9:18 PM Erick Erickson <erickerick...@gmail.com> > wrote: > >> First, Solr does _not_ implement boolean logic. It can look like it, but >> that’s sugar. >> See: https://lucidworks.com/post/why-not-and-or-and-not/ >> >> As for (1), I haven’t a clue. If you’d provided the results of >> adding &debug=query to the query, the parsed version >> would have given us some pointers. >> >> (2) Yes, See the reference above. the NOT (-) operator is really >> “from the results so far, remove everything that satisfies this clause”. >> But just -field_to_exclude:[* TO *] has nothing to remove >> things that satisfy this clause _from_. >> >> >> And a couple of nits: >> There’s no need for the AND, again, see the reference above. >> ((*:* -field_to_exclude:*)) would work just fine. >> >> Second, and just to confuse you, the *:* is not required in fq >> clauses, there’s some special logic to handle >> fq=-field_to_exclude:* >> that implies the *:* that you’d have to put in a “q” clause. >> >> Third, field_to_exclude:* is actually fairly inefficient, >> fq=-field_to_exclude:[* TO *] >> can be more efficient. The reasons are rather arcane... >> >> Best, >> Erick >> >>> On Sep 11, 2020, at 10:18 AM, Iana Bondarska <yana2...@gmail.com> wrote: >>> >>> Hi everyone, >>> I'm checking Solr query that contains condition "Exclude all documents >> that >>> contain ceratin field". >>> Currently, it looks like this: >>> *(*:* AND -field_to_exclude:*)* >>> >>> Full query is: >>> *((some_other_field:"value") AND ((*:* AND -field_to_exclude:*)))* >>> >>> If I use defType=edismax, nothing is found. If I use default defType - I >>> get correct results, same as when I do not specify *:* in non-exists >>> condition. >>> >>> My questions are: >>> 1) why defType "edismax" leads to empty results? >>> 2) do we really need to include clause "**:**" in non-exists condition? >>> Isn't *-field_to_exclude:* *enough? >>> -- >>> Best Regards, >>> Iana Bondarska >> >> > > -- > Best Regards, > Iana Bondarska