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 Em <ma...@yahoo.de> on 2010/12/30 15:04:06 UTC

Sort Facet Query

Hi List,

I got a little issue with sorting a FacetQuery.

Currently I am doing something like that in SolrJ:

SolrQuery q = new SolrQuery("myQuery");
q.setFacetQuery("names:thomas");//want to see the count of thomas's
documents.
q.setFacetPrefix("short", "th");

I don't know any better example, but the result from all those facets should
be returned in lexicographic order, not by count - so i can ensure that
every constraint is returned at the same place.

Any ideas?

Thank you!

-- 
View this message in context: http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2167635.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Sort Facet Query

Posted by Erik Hatcher <er...@gmail.com>.
There's nothing to sort in the results of a facet.query.... all you get back is a single count of docs that match that query (within the q/fq constraints).

	Erik

On Jan 3, 2011, at 07:46 , Em wrote:

> 
> Hi,
> 
> thanks for your reply, but this seems not to work on my facetQuery.
> 
> I mean this param: facet.query=this:that*
> And I want to sort the results of that query.
> 
> Or should I better use the facet.prefix-feature?
> 
> Thank you!
> 
> 
> Grijesh.singh wrote:
>> 
>> Use parameter as Per Field Basis as
>> 
>> f.<your field name>.facet.sort=index
>> 
>> Solr1.4 -- the true/false values have been deprecated starting with Solr
>> 1.4, instead use count for sorting by count, and index for sorting by
>> index order.
>> 
>> The default is true/count if facet.limit is greater than 0, false/index
>> otherwise.
>> 
>> This parameter can be specified on a per field basis.
>> 
> 
> -- 
> View this message in context: http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2184506.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Sort Facet Query

Posted by Em <ma...@yahoo.de>.
Hi,

thanks for your reply, but this seems not to work on my facetQuery.

I mean this param: facet.query=this:that*
And I want to sort the results of that query.

Or should I better use the facet.prefix-feature?

Thank you!


Grijesh.singh wrote:
> 
> Use parameter as Per Field Basis as
> 
> f.<your field name>.facet.sort=index
> 
>  Solr1.4 -- the true/false values have been deprecated starting with Solr
> 1.4, instead use count for sorting by count, and index for sorting by
> index order.
> 
> The default is true/count if facet.limit is greater than 0, false/index
> otherwise.
> 
> This parameter can be specified on a per field basis.
> 

-- 
View this message in context: http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2184506.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Sort Facet Query

Posted by "Grijesh.singh" <pi...@gmail.com>.
Use parameter as Per Field Basis as

f.<your field name>.facet.sort=index

 Solr1.4 -- the true/false values have been deprecated starting with Solr
1.4, instead use count for sorting by count, and index for sorting by index
order.

The default is true/count if facet.limit is greater than 0, false/index
otherwise.

This parameter can be specified on a per field basis.

-----
Grijesh
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2183858.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Sort Facet Query

Posted by Em <ma...@yahoo.de>.
Yes, I understood.

But what if I DON'T want to return ALL facet fields in index-order, but only
2 of 5?

When faceting on fields I could just specify it, but how can I do so with a
FacetQuery without making *all* Facets sorted in the same way?
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2168762.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Sort Facet Query

Posted by Erick Erickson <er...@gmail.com>.
At the end of Marcus' link is facet.sort=false which will return in
lexigraphical order (sometimes called index order).

Best
Erick

On Thu, Dec 30, 2010 at 10:26 AM, Em <ma...@yahoo.de> wrote:

>
> Markus is right, it will return them by count.
>
> I think my question could me more general:
>
> How can I set limit, sort etc. for a Facet Query?
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2167965.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Sort Facet Query

Posted by Em <ma...@yahoo.de>.
Markus is right, it will return them by count.

I think my question could me more general:

How can I set limit, sort etc. for a Facet Query?
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2167965.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Sort Facet Query

Posted by Markus Jelsma <ma...@openindex.io>.
No
http://wiki.apache.org/solr/SimpleFacetParameters#facet.sort


On Thursday 30 December 2010 15:42:14 Stephen Duncan Jr wrote:
> Set facet.limit to -1 (globally or for that field).  That will return all
> the facets, in lexicographical order.
> 
> Stephen Duncan Jr
> www.stephenduncanjr.com
> 
> On Thu, Dec 30, 2010 at 9:04 AM, Em <ma...@yahoo.de> wrote:
> > Hi List,
> > 
> > I got a little issue with sorting a FacetQuery.
> > 
> > Currently I am doing something like that in SolrJ:
> > 
> > SolrQuery q = new SolrQuery("myQuery");
> > q.setFacetQuery("names:thomas");//want to see the count of thomas's
> > documents.
> > q.setFacetPrefix("short", "th");
> > 
> > I don't know any better example, but the result from all those facets
> > should
> > be returned in lexicographic order, not by count - so i can ensure that
> > every constraint is returned at the same place.
> > 
> > Any ideas?
> > 
> > Thank you!
> > 
> > --
> > View this message in context:
> > http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2167635.htm
> > l Sent from the Solr - User mailing list archive at Nabble.com.

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

Re: Sort Facet Query

Posted by Stephen Duncan Jr <st...@gmail.com>.
Set facet.limit to -1 (globally or for that field).  That will return all
the facets, in lexicographical order.

Stephen Duncan Jr
www.stephenduncanjr.com


On Thu, Dec 30, 2010 at 9:04 AM, Em <ma...@yahoo.de> wrote:

>
> Hi List,
>
> I got a little issue with sorting a FacetQuery.
>
> Currently I am doing something like that in SolrJ:
>
> SolrQuery q = new SolrQuery("myQuery");
> q.setFacetQuery("names:thomas");//want to see the count of thomas's
> documents.
> q.setFacetPrefix("short", "th");
>
> I don't know any better example, but the result from all those facets
> should
> be returned in lexicographic order, not by count - so i can ensure that
> every constraint is returned at the same place.
>
> Any ideas?
>
> Thank you!
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Sort-Facet-Query-tp2167635p2167635.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>