Re: Different sort for each facet
I'm glad that you have something working, but you shouldn't have to remove that facet.sort=index. I tried the following and it works with the Solr 3.6 example after I indexed with exampledocs/books.json: http://localhost:8983/solr/select/?q=*:*&facet=true&facet.field=name&facet.field=genre_s&facet.sort=index&f.name.facet.sort=count I see the name field sorted by count and the genre_s field sorted by lexical order (note: "IT" comes before "fantasy" because upper case comes before lower case - it would be nice to have a case-neutral sort.) Could you try it, just to see if maybe we are not communicating about what exactly is not working for you? What release of Solr are you using? I am not aware of any fixes/changes that would make this behave differently as of 3.6. BTW, the default sort is "index" IFF facet.limit <= 0. The default for facet.limit is 100, so sort should default to "count". I presume you have facet.limit set to -1 or 0. You might also check to see what facet parameters might be set in your request handler as opposed to on the actual query request. -- Jack Krupansky -Original Message- From: Christopher Gross Sent: Wednesday, June 13, 2012 9:19 AM To: solr-user@lucene.apache.org Subject: Re: Different sort for each facet Hmm, it seems that if I leave off the initial "facet.sort=index" then it will sort each by index by default, and I can use the "f.people.facet.sort=count" as expected. I thought I tried that yesterday, but I suppose it slipped my mind in my sleep-deprived state. Thanks Jack! -- Chris On Tue, Jun 12, 2012 at 10:58 PM, Jack Krupansky wrote: f.people.facet.sort=count should work. Make sure you don't have a conflicting setting for that same field and attribute. Does the "people" facet sort by count correctly with f.sort=index? What are the attributes and field type for the "people" field? -- Jack Krupansky -----Original Message----- From: Christopher Gross Sent: Tuesday, June 12, 2012 11:05 AM To: solr-user Subject: Different sort for each facet In Solr 3.4, is there a way I can sort two facets differently in the same query? If I have: http://mysolrsrvr/solr/select?q=*:*&facet=true&facet.field=people&facet.field=category is there a way that I can sort people by the count and category by the name all in one query? Or do I need to do that in separate queries? I tried using "f.people.facet.sort=count" while also having "facet.sort=index" but both came back in alphabetical order. Doing more queries is OK, I'm just trying to avoid having to do too many. -- Chris
Re: Different sort for each facet
Hmm, it seems that if I leave off the initial "facet.sort=index" then it will sort each by index by default, and I can use the "f.people.facet.sort=count" as expected. I thought I tried that yesterday, but I suppose it slipped my mind in my sleep-deprived state. Thanks Jack! -- Chris On Tue, Jun 12, 2012 at 10:58 PM, Jack Krupansky wrote: > f.people.facet.sort=count should work. > > Make sure you don't have a conflicting setting for that same field and > attribute. > > Does the "people" facet sort by count correctly with f.sort=index? > > What are the attributes and field type for the "people" field? > > -- Jack Krupansky > > -Original Message- From: Christopher Gross > Sent: Tuesday, June 12, 2012 11:05 AM > To: solr-user > Subject: Different sort for each facet > > > In Solr 3.4, is there a way I can sort two facets differently in the same > query? > > If I have: > > http://mysolrsrvr/solr/select?q=*:*&facet=true&facet.field=people&facet.field=category > > is there a way that I can sort people by the count and category by the > name all in one query? Or do I need to do that in separate queries? > I tried using "f.people.facet.sort=count" while also having > "facet.sort=index" but both came back in alphabetical order. > > Doing more queries is OK, I'm just trying to avoid having to do too many. > > -- Chris
Re: Different sort for each facet
f.people.facet.sort=count should work. Make sure you don't have a conflicting setting for that same field and attribute. Does the "people" facet sort by count correctly with f.sort=index? What are the attributes and field type for the "people" field? -- Jack Krupansky -Original Message- From: Christopher Gross Sent: Tuesday, June 12, 2012 11:05 AM To: solr-user Subject: Different sort for each facet In Solr 3.4, is there a way I can sort two facets differently in the same query? If I have: http://mysolrsrvr/solr/select?q=*:*&facet=true&facet.field=people&facet.field=category is there a way that I can sort people by the count and category by the name all in one query? Or do I need to do that in separate queries? I tried using "f.people.facet.sort=count" while also having "facet.sort=index" but both came back in alphabetical order. Doing more queries is OK, I'm just trying to avoid having to do too many. -- Chris
Different sort for each facet
In Solr 3.4, is there a way I can sort two facets differently in the same query? If I have: http://mysolrsrvr/solr/select?q=*:*&facet=true&facet.field=people&facet.field=category is there a way that I can sort people by the count and category by the name all in one query? Or do I need to do that in separate queries? I tried using "f.people.facet.sort=count" while also having "facet.sort=index" but both came back in alphabetical order. Doing more queries is OK, I'm just trying to avoid having to do too many. -- Chris