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 Jae Joo <ja...@gmail.com> on 2020/12/11 14:30:37 UTC

Function Query Optimization

I have the requirement to create field  - xyz to be returned based on the
matched result.
Here Is the code .

XYZ:concat(

    if(exists(query({!v='field1:12345'})), '<G>12345</G>', ''),

    if(exists(query({!v='field1:23456'})), '<G>23456</G>', ''),

    if(exists(query({!v='field1:34567'})), '<G>34567</G>', ''),

    if(exists(query({!v='field:45678'})), '<G>45678</G>','')
),

I am feeling this is very complex, so I am looking for some smart and
faster ideas.

Thanks,

Jae

Re: Function Query Optimization

Posted by Jae Joo <ja...@gmail.com>.
Should SubQuery be faster than FunctionQuery?

On Sat, Dec 12, 2020 at 10:24 AM Vincenzo D'Amore <v....@gmail.com>
wrote:

> Hi, looking at this sample it seems you have just one document for '12345',
> one for '23456' and so on so forth. If this is true, why don't just try
> with a subquery
>
> https://lucene.apache.org/solr/guide/6_6/transforming-result-documents.html#TransformingResultDocuments-_subquery_
>
> On Fri, Dec 11, 2020 at 3:31 PM Jae Joo <ja...@gmail.com> wrote:
>
> > I have the requirement to create field  - xyz to be returned based on the
> > matched result.
> > Here Is the code .
> >
> > XYZ:concat(
> >
> >     if(exists(query({!v='field1:12345'})), '<G>12345</G>', ''),
> >
> >     if(exists(query({!v='field1:23456'})), '<G>23456</G>', ''),
> >
> >     if(exists(query({!v='field1:34567'})), '<G>34567</G>', ''),
> >
> >     if(exists(query({!v='field:45678'})), '<G>45678</G>','')
> > ),
> >
> > I am feeling this is very complex, so I am looking for some smart and
> > faster ideas.
> >
> > Thanks,
> >
> > Jae
> >
>
>
> --
> Vincenzo D'Amore
>

Re: Function Query Optimization

Posted by Vincenzo D'Amore <v....@gmail.com>.
Hi, looking at this sample it seems you have just one document for '12345',
one for '23456' and so on so forth. If this is true, why don't just try
with a subquery
https://lucene.apache.org/solr/guide/6_6/transforming-result-documents.html#TransformingResultDocuments-_subquery_

On Fri, Dec 11, 2020 at 3:31 PM Jae Joo <ja...@gmail.com> wrote:

> I have the requirement to create field  - xyz to be returned based on the
> matched result.
> Here Is the code .
>
> XYZ:concat(
>
>     if(exists(query({!v='field1:12345'})), '<G>12345</G>', ''),
>
>     if(exists(query({!v='field1:23456'})), '<G>23456</G>', ''),
>
>     if(exists(query({!v='field1:34567'})), '<G>34567</G>', ''),
>
>     if(exists(query({!v='field:45678'})), '<G>45678</G>','')
> ),
>
> I am feeling this is very complex, so I am looking for some smart and
> faster ideas.
>
> Thanks,
>
> Jae
>


-- 
Vincenzo D'Amore