Ah I see! I must say this was not at all clear from the documentation. A
few more examples would have helped. Also the fact that there are several
boolean functions available (eg:exists(field)) also led me to thinking that
these could be used in 'fq'. And yes, I am aware of the lucene syntax for
negation ( fq=-(popularity:[* TO *]) in your example), but was just playing
around with functions trying to find a solution to a use-case I am
working on.
Thanks for your response!

Rahul

On Mon, Jun 28, 2021 at 6:18 AM Alessandro Benedetti <a.benede...@sease.io>
wrote:

> Hi,
> if I remember correctly, the {!func} query parser just uses the function to
> assign the score to the search results.
> It won't make much sense to use it in a 'fq' parameter.
> I agree it's not well documented though.
>
> You may be interested in the frange query parser instead:
>
> https://solr.apache.org/guide/8_8/other-parsers.html#function-range-query-parser
>  .
>
> Aside from that, you may achieve the same with a simple range query:
> fq=-(popularity:[* TO *]) (make sure the query parser you use it, supports
> pure negative clauses.
>
> Cheers
> --------------------------
> Alessandro Benedetti
> Apache Lucene/Solr Committer
> Director, R&D Software Engineer, Search Consultant
>
> www.sease.io
>
>
> On Fri, 25 Jun 2021 at 14:12, Rahul Goswami <rahul196...@gmail.com> wrote:
>
> > Hello,
> > I am using Solr 7.7.2. Below query is not returning expected results on
> the
> > sample "techproducts" core.
> >
> >
> >
> http://localhost:8983/solr/techproducts/select?debug=query&fq={!func}not(exists(popularity))&q=*:*&wt=json&rows=1
> >
> > The query returns ALL documents in 'numFound' despite the 'not' function.
> > Result is the same even when with defType=edismax (although that should
> not
> > interfere since I am specifying the 'func' parser).
> > Does this warrant a JIRA?
> >
> > Thanks,
> > Rahul
> >
>

Reply via email to