Oh, isn't that ducky. The facet.sort parameter only sorts ascending
as far as I can tell. Which is exactly the reverse of what you want.

Would it work to cleverly encode the facet field to do what you want
just by a lexical sort? Something like use a very large constant,
subtract the date for each record from that and then put that in a
new field that you facet/sort by? Then un-transform it for display? Let's
say you have a range from 0-9. Then your facet field could be
something like
original doc values
doc 1: 2 <- oldest
doc 2: 5
doc 3: 8  <- newest

You'd store values like these in "facetme" (9 - orig value) + text
doc1: 7_docid1
doc2: 4_docid2
doc3: 1_docid3

Now a natural ordering (facet.sort=index) wold return them in
date order. If this was a well-defined process you could easily
transform it back for proper display. Although watch out for
leading zeros!

Thinking off the top of my head here....

Erick

On Thu, May 19, 2011 at 9:46 AM, Dmitry Kan <dmitry....@gmail.com> wrote:
> Hi,
>
> Thanks for the questions, guys, and sorry for the confusion. I should start
> with a broader picture of what we are trying to achieve. The only problem is
> that I cannot speak about specifics of the task we are solving the way we
> do. We currently sort the facets on the client side, having the date values
> at hand (done by an boolean query to SOLR with a list of ids). However,
> sometimes we have "glitches", that is since we limit the facets to first
> facet.limit ones, and there is no "date boosting" we may have some facet
> counts end up beyond the facet counts range and that's sad. One way around
> it would be to facet with pagination, where a page would correspond to a
> date subrange in the range of required dates. But we haven't tried it yet
> before we investigate what can be done inside SOLR (by modifying its source
> code, if needed).
>
> So as said every solr doc that has some id in the solr index (this id is
> used to combine several solr docs logically, only that purpose; this design
> comes from the task definition) has a date field, and the value of that date
> field is always same for a given doc id across all the solr docs with the
> same doc id.
>
> Now, taking the Stefan's example, I would like to sort desc the facets by
> date (yes, date boosting during the facet gathering process) that were
> calculated against someStr field:
>
> <int name="T-AS_1386181">
> 45
> </int>
> <int name="T-AS_1386229">
> 54
> </int>
>
> So SOLR facet component would ignore the counts and sort the facets by dates
> desc (in reverse chronological order).
>
> Is it possible to implement such a solution through some class inheritance
> in facet component?
>
> Regards,
>
> Dmitry
>
> On Thu, May 19, 2011 at 4:25 PM, Stefan Matheis <
> matheis.ste...@googlemail.com> wrote:
>
>> Dmitry,
>>
>> how should that work? Take a this short sample-data:
>>
>> id | date
>> T-AS_1386229 | 1995-12-31T23:59:59Z
>> T-AS_1386181 | 1996-12-31T23:59:59Z
>> T-AS_1386229 | 1997-12-31T23:59:59Z
>>
>> So, you'll have two facets for the ids .. but how should they be
>> sorted? One (of the two) is the first and the other the last Document
>> .. so, sort by lowest date? highest date? i guess, that would/could
>> not really work.
>>
>> Perhaps we have to ask another Question .. what are you trying to
>> achieve? "Boost by Date"?
>>
>> Regards
>> Stefan
>>
>> On Thu, May 19, 2011 at 2:24 PM, Dmitry Kan <dmitry....@gmail.com> wrote:
>> > Hi Erick,
>> >
>> > It is about ordering the facet information. The result set is empty via
>> > rows=0.
>> >
>> > Here is the logics and example:
>> >
>> > Each doc has string field someStr and a date field associated with it,
>> and
>> > same doc id has same value of the date field. Question: is it possible to
>> > sort the facet values given below on that date field?
>> >
>> > curl
>> >
>> http://localhost:8983/solr/select?q=someStr:network&facet=true&facet.field=id&facet.limit=1000&facet.mincount=1&rows=0
>> >
>> > result excerpt:
>> >
>> > <lst name="facet_fields">
>> > <lst name="id">
>> > <int name="T-AS_1386229">
>> > 54
>> > </int>
>> > <int name="T-AS_1386181">
>> > 45
>> > </int>
>> > <int name="T-CP_1370095">
>> > 36
>> > </int>
>> > <int name="T-AS_1377809">
>> > 25
>> > </int>
>> > <int name="T-CP_1380207">
>> > 18
>> > </int>
>> > <int name="T-CP_1373820">
>> > 11
>> > </int>
>> > <int name="T-AS_1372073-1">
>> > 8
>> > </int>
>> > <int name="T-AS_1367577">
>> > 6
>> > </int>
>> > <int name="T-AS_1383141">
>> > 5
>> > </int>
>> > <int name="T-AS_1383648-1">
>> > 5
>> > </int>
>> > <int name="T-AS_1351183-1">
>> > 4
>> > </int>
>> > </lst>
>> > </lst>
>> >
>> >
>> > Regards,
>> >
>> > Dmitry
>> >
>> >
>> >
>> >
>> > On Wed, May 18, 2011 at 3:33 PM, Erick Erickson <erickerick...@gmail.com
>> >wrote:
>> >
>> >> Can you provide an example of what you are trying to do? Are you
>> >> referring to ordering the result set or the facet information?
>> >>
>> >> Best
>> >> Erick
>> >>
>> >> On Wed, May 18, 2011 at 7:21 AM, Dmitry Kan <dmitry....@gmail.com>
>> wrote:
>> >> > Hello list,
>> >> >
>> >> > Is it possible to sort on date field in a facet query in SOLR 3.1?
>> >> >
>> >> > --
>> >> > Regards,
>> >> >
>> >> > Dmitry Kan
>> >> >
>> >>
>> >
>>
>

Reply via email to