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 ~$alpha` <la...@gmail.com> on 2018/02/12 15:32:42 UTC

Solr Expression Slow

In the below Solr query I am sorting based on the below expression.

> sum(if(and(tf(CRITERIA1_FILTER,Y),if(tf(PARTNER_CRITERIA1,N),0,1)),1,0),if(and(tf(CRITERIA2_FILTER,Y),if(tf(PARTNER_CRITERIA2,1),0,1)),1,0))
> asc

I have mentioned PARTNER_CRITERIA1 and PARTNER_CRITERIA2 in the expression.
I have similar10 expression like this.

I want to remove expression as it is slow,
Is it better to use custom sorting for such case and if yes, can someone
help how to do so?





--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Solr Expression Slow

Posted by ~$alpha` <la...@gmail.com>.
It cannot be done at indexing time. its based onloggedin user info



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Solr Expression Slow

Posted by Erik Hatcher <er...@gmail.com>.
I suggest applying that logic at index time and build yourself a SORT_CRITERIA field and use that rather than that sophisticated function that looks like it could collapse down to a single index-time field.

	Erik


> On Feb 12, 2018, at 10:32 AM, ~$alpha` <la...@gmail.com> wrote:
> 
> In the below Solr query I am sorting based on the below expression.
> 
>> sum(if(and(tf(CRITERIA1_FILTER,Y),if(tf(PARTNER_CRITERIA1,N),0,1)),1,0),if(and(tf(CRITERIA2_FILTER,Y),if(tf(PARTNER_CRITERIA2,1),0,1)),1,0))
>> asc
> 
> I have mentioned PARTNER_CRITERIA1 and PARTNER_CRITERIA2 in the expression.
> I have similar10 expression like this.
> 
> I want to remove expression as it is slow,
> Is it better to use custom sorting for such case and if yes, can someone
> help how to do so?
> 
> 
> 
> 
> 
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html