You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Arcadius Ahouansou <ar...@menelic.com> on 2014/05/22 19:20:43 UTC

IF function and FieldList

Hello.

I need to have dynamically assigned field list (fl) depending on the
existence of a field in the response.
I need to do something like

fl=if(exists(field0),field0 field1,field2 field3))

The problem is that the "if" function does not like the space.
I have tried many combinations like double or quotes around the field list:
fl=if(exists(field0),'field0 field1','field2 field3'))
or
fl=if(exists(field0),"field0,field1","field2,field3"))

or parenthesis etc.

Any help would be very appreciated.

Thanks.

Arcadius.

Re: IF function and FieldList

Posted by Arcadius Ahouansou <ar...@menelic.com>.
Thanks Erick.

Arcadius.


On 22 May 2014 22:14, Erick Erickson <er...@gmail.com> wrote:

> Why not just return them all and sort it out on the app layer? Seems
> easier....
>
> Or consider doc transformers I suppose.
>
> Best,
> Erick
>
> On Thu, May 22, 2014 at 10:20 AM, Arcadius Ahouansou
> <ar...@menelic.com> wrote:
> > Hello.
> >
> > I need to have dynamically assigned field list (fl) depending on the
> > existence of a field in the response.
> > I need to do something like
> >
> > fl=if(exists(field0),field0 field1,field2 field3))
> >
> > The problem is that the "if" function does not like the space.
> > I have tried many combinations like double or quotes around the field
> list:
> > fl=if(exists(field0),'field0 field1','field2 field3'))
> > or
> > fl=if(exists(field0),"field0,field1","field2,field3"))
> >
> > or parenthesis etc.
> >
> > Any help would be very appreciated.
> >
> > Thanks.
> >
> > Arcadius.
>

Re: IF function and FieldList

Posted by Erick Erickson <er...@gmail.com>.
Why not just return them all and sort it out on the app layer? Seems easier....

Or consider doc transformers I suppose.

Best,
Erick

On Thu, May 22, 2014 at 10:20 AM, Arcadius Ahouansou
<ar...@menelic.com> wrote:
> Hello.
>
> I need to have dynamically assigned field list (fl) depending on the
> existence of a field in the response.
> I need to do something like
>
> fl=if(exists(field0),field0 field1,field2 field3))
>
> The problem is that the "if" function does not like the space.
> I have tried many combinations like double or quotes around the field list:
> fl=if(exists(field0),'field0 field1','field2 field3'))
> or
> fl=if(exists(field0),"field0,field1","field2,field3"))
>
> or parenthesis etc.
>
> Any help would be very appreciated.
>
> Thanks.
>
> Arcadius.