[Xapian-discuss] Re: Sorting by date and time

Olly Betts olly at survex.com
Mon Dec 19 06:47:48 GMT 2005

Olly Betts <olly at survex.com> writes:
> There are 3 approaches:
> (a) Put the timestamp in a document value, and then sort on that value
> SORT=0 if you put the timestamp in value number 0.
> (b) Create suitable D, M, and Y prefix terms and use Omega's date
> sorting feature.  E.g. D20051004 M200510 Y2005 for a document
> dated today.

Erm, I'm talking rubbish here so to avoid confusion for those who find
this thread in the list archives I'll correct myself.  This is an option
if you wanted to FILTER by date, not SORT by date (the other way to filter
by date would be to use a MatchDecider on a value with a timestamp in).

> (c) Arrange that documents are indexed in exact date order (or close
> enough that you don't care about discrepancies) and then implement
> "sort by date" by using set_weighting_scheme(BoolWeight()) and
> set_docid_order(DESCENDING) - currently you'll need to patch Omega
> to do this.
> Option (c) will give the fastest date search (especially once I finish
> off a patch I've been working on), but can be fiddly to implement on
> the indexing side.

So the options for date sorting are (a) and (c).


More information about the Xapian-discuss mailing list