So the AND didn't short circuit. That seems like it needs to be fixed.


Joel Bernstein
http://joelsolr.blogspot.com/


On Wed, Jul 6, 2022 at 3:20 PM Kojo <[email protected]> wrote:

> I have made it work, like this:
>
>
> having(
> having(
> ANY STREAM
> and(notNull(NULL FIELD), True)),
> and( eq(MAYBE NULL FIELD, val(FIELD STR)), TRUE))
>
> Em qua., 6 de jul. de 2022 às 10:09, Kojo <[email protected]> escreveu:
>
> > Joel, this seems to be pretty new. You are hero!
> >
> > But I still have a problem. Please check below.
> >
> > This works:
> > having(
> > ANY STREAM
> > and(notNull(NULL FIELD)))
> > )
> >
> > This doesn't work, as expected, since and function does not short circuit
> > and evaluate all values:
> > having(
> > ANY STREAM
> > and(notNull(NULL FIELD), eq(NULL FIELD, val(ANY VALUE)))
> > )
> >
> > I need something like the examples below, but they don't work:
> > having(
> > ANY STREAM
> > eq(isNull(FIELD), 'AAA', FIELD), val(ANY VALUE))
> > )
> >
> > having(
> > ANY STREAM
> > eq(if(notNull(FIELD), FIELD, 'aaa'), val(ANY VALUE)))
> > )
> >
> > Always the same exception:
> >
> >         "EXCEPTION": "Unable to check eq(...) because a null value was
> found",
> >
> >
> >
> > Can you help me?
> >
> >
> > Em ter., 5 de jul. de 2022 às 22:13, Joel Bernstein <[email protected]>
> > escreveu:
> >
> >> Here are some null handling examples:
> >>
> >>
> >>
> https://solr.apache.org/guide/solr/latest/query-guide/transform.html#handling-nulls
> >>
> >>
> >>
> >> Joel Bernstein
> >> http://joelsolr.blogspot.com/
> >>
> >>
> >> On Tue, Jul 5, 2022 at 4:44 PM Kojo <[email protected]> wrote:
> >>
> >> > I found this e-mail archive
> >> > https://lists.apache.org/thread/vk3o0zz1w4grcj2chfqcwg8twg8t08gc that
> >> > seems
> >> > to be related to this issue, but I did not found any Jira ticket or
> any
> >> > other comment.
> >> >
> >> > Can you give me some advice?
> >> >
> >> > Em seg., 4 de jul. de 2022 às 22:24, Kojo <[email protected]>
> >> escreveu:
> >> >
> >> > > I cannot check equality against null in Solr 9.0. It always raise
> >> > > exception. IE:
> >> > >
> >> > > having(
> >> > > STREAM
> >> > > eq(any_valid_field, null))
> >> > >
> >> > > "EXCEPTION": "Unable to check eq(...) because a null value was
> found"
> >> > >
> >> > > Does the statement below changed in Solr 9.0?
> >> > >
> >> > > Thanks!
> >> > >
> >> > > if Syntax
> >> > > <
> >> >
> >>
> https://solr.apache.org/guide/8_4/stream-evaluator-reference.html#if-syntax
> >> > >
> >> > >
> >> > > The expressions below show the various ways in which you can use the
> >> if
> >> > >  evaluator.
> >> > >
> >> > > if(fieldA,fieldB,fieldC) // if fieldA is true then fieldB else
> fieldC
> >> > > if(gt(fieldA,5), fieldA, 5) // if fieldA > 5 then fieldA else 5
> >> > > if(eq(fieldB,null), null, div(fieldA,fieldB)) // if fieldB is null
> >> then
> >> > null else fieldA / fieldB
> >> > >
> >> > >
> >> >
> >>
> >
>

Reply via email to