That's right. It should work if I already know these values ahead of time, however I want to use business rules to control display orders for different search terms. Maybe I have to code it by myself. Thanks everyone.
On Fri, Aug 5, 2011 at 12:25 AM, Jayendra Patil < jayendra.patil....@gmail.com> wrote: > you can give it a try with the facet.sort. > > We had such a requirement for sorting facets by order determined by > other field and had to resort to a very crude way to get through it. > We pre-pended the facets values with the order in which it had to be > displayed ... and used the facet.sort to sort alphabetically. > > e.g. prepend Small -> 0_Small, Medium -> 1_Medium, Large -> 2_Large, XL -> > 3_XL > > You would need to handle the display part though. > > Surely not the best way, but worked for us. > > Regards, > Jayendra > > On Thu, Aug 4, 2011 at 4:38 PM, Sethi, Parampreet > <parampreet.se...@teamaol.com> wrote: > > It can be achieved by creating own (app specific) custom comparators for > > fields defined in schema.xml and having an extra attribute to specify the > > comparator class in the field tag itself. But it will require changes in > the > > Solr to support this feature. (Not sure if it's feasible though just > > throwing an idea.) > > > > -param > > > > On 8/4/11 4:29 PM, "Jonathan Rochkind" <rochk...@jhu.edu> wrote: > > > >> No, it can not. It just sorts "alphabetically", actually by raw > byte-order. > >> > >> No other facet sorting functionality is available, and it would be > >> tricky to implement in a performant way because of the way lucene > >> works. But it would certainly be useful to me too if someone could > >> figure out a way to do it. > >> > >> On 8/4/2011 2:43 PM, Way Cool wrote: > >>> Thanks Eric for your reply. I am aware of facet.sort, but I haven't > used it. > >>> I will try that though. > >>> > >>> Can it handle the values below in the correct order? > >>> Under 10 > >>> 10 - 20 > >>> 20 - 30 > >>> Above 30 > >>> > >>> Or > >>> Small > >>> Medium > >>> Large > >>> XL > >>> ... > >>> > >>> My second question is that if Solr can't do that for the values above > by > >>> using facet.sort. Is there any other ways in Solr? > >>> > >>> Thanks in advance, > >>> > >>> YH > >>> > >>> On Wed, Aug 3, 2011 at 8:35 PM, Erick Erickson<erickerick...@gmail.com > >wrote: > >>> > >>>> have you looked at the facet.sort parameter? The "index" value is what > I > >>>> think you want. > >>>> > >>>> Best > >>>> Erick > >>>> On Aug 3, 2011 7:03 PM, "Way Cool"<way1.wayc...@gmail.com> wrote: > >>>>> Hi, guys, > >>>>> > >>>>> Is there anyway to sort differently for facet values? For example, > >>>> sometimes > >>>>> I want to sort facet values by their values instead of # of docs, and > I > >>>> want > >>>>> to be able to have a predefined order for certain facets as well. Is > that > >>>>> possible in Solr we can do that? > >>>>> > >>>>> Thanks, > >>>>> > >>>>> YH > > > > >