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 ramzesua <mi...@gmail.com> on 2011/04/06 12:48:56 UTC

sort by function problem

I try to use sort by function in a new release of SOLR 3.1, but I have some
problems, for example:
http://localhost:8983/new_search/select?q=mothers
day&indent=true&fl=templateSetId,score,templateSetPopularity&sort=product(templateSetPopularity,query(mothers
day)) desc
templateSetPopularity - my field with popularity rank
query(mothers+day,0.0) - I try to get score value
At result I get error:
HTTP Status 400 - Can't determine Sort Order:
'sum(templateSetPopularity,query(mothers day)) desc', pos=3
Where is my error? 

--
View this message in context: http://lucene.472066.n3.nabble.com/sort-by-function-problem-tp2784493p2784493.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: sort by function problem

Posted by Yonik Seeley <yo...@lucidimagination.com>.
The problem is "query(mothers day)"
See http://wiki.apache.org/solr/FunctionQuery#query

You can't directly include query syntax because the function parser
wouldn't know how to get to the end of that syntax.
You could either do
   "query($qq)"  and then add a "qq=mothers day" to the request
Or if you really wanted the whole thing inline, you could do
   "query({!v='mothers day'})

But the first form is nicer since you don't have to worry about
escaping at all, and I think it's also more readable.

-Yonik
http://www.lucenerevolution.org -- Lucene/Solr User Conference, May
25-26, San Francisco


On Wed, Apr 6, 2011 at 6:48 AM, ramzesua <mi...@gmail.com> wrote:
> I try to use sort by function in a new release of SOLR 3.1, but I have some
> problems, for example:
> http://localhost:8983/new_search/select?q=mothers
> day&indent=true&fl=templateSetId,score,templateSetPopularity&sort=product(templateSetPopularity,query(mothers
> day)) desc
> templateSetPopularity - my field with popularity rank
> query(mothers+day,0.0) - I try to get score value
> At result I get error:
> HTTP Status 400 - Can't determine Sort Order:
> 'sum(templateSetPopularity,query(mothers day)) desc', pos=3
> Where is my error?
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/sort-by-function-problem-tp2784493p2784493.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>