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 shacky <sh...@gmail.com> on 2014/11/21 12:17:48 UTC

Order by field's values custom list

Hi.
I'm using Solr 1.4.1 (I know it's an old version) and I'm trying to
find a way to sort found record using a custom list of field values.

The same as MySQL's "ORDER BY FIELD()" function:

SELECT * FROM fruit ORDER BY FIELD(name, 'Banana', 'Apple', 'Pear',
'Orange'), variety;

Could you help me please?

Thank you very much!
Bye

Re: Order by field's values custom list

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
see if() function example at
https://cwiki.apache.org/confluence/display/solr/Function+Queries

On Fri, Nov 21, 2014 at 2:17 PM, shacky <sh...@gmail.com> wrote:

> Hi.
> I'm using Solr 1.4.1 (I know it's an old version) and I'm trying to
> find a way to sort found record using a custom list of field values.
>
> The same as MySQL's "ORDER BY FIELD()" function:
>
> SELECT * FROM fruit ORDER BY FIELD(name, 'Banana', 'Apple', 'Pear',
> 'Orange'), variety;
>
> Could you help me please?
>
> Thank you very much!
> Bye
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mk...@griddynamics.com>