[Xapian-discuss] Re: searching and sorting by date
xingshou at gmail.com
Wed Mar 22 12:23:54 GMT 2006
> We have a use case where we must return the first 50 most recent
> documents that match our query. We don't want the first 50 matches to
> the query that are then sorted by date. I hope the distinction is clear
> enough. What we are unsure of from reading the documents is if setting
> a sort value on our query (enq.set_sort_by_value()) will return the
> first 50 documents that match the query, or the first 50 matches, then
> sorted by that value.
Xapian will perform query first with given query terms and then it will
sort by value. It will sort the whole result, so you don't worry if the
results are only first 50 matches.
When query terms are blank it will return nothing, it means MSet would
be empty. Therefore you must give something as query terms. I guess this
is the main concern to you in the view point of general RDBMS, because
in RDBMS we can get all or only first 50 rows in date order.
You can put date to the term list such as 'D20060322' when indexing
documents, and simultaneously put the date into value. And you can
search by 'D2006*' or 'D200603*' and use set_sort_by_value() to the date
value. If docid is in the same order as date, you don't have to use
My answer would be inappropriate, and you can get better idea from others.
More information about the Xapian-discuss