[Xapian-discuss] How does the sorting of search result work in Xapian?

Ram Peters rampeters at gmail.com
Thu Apr 5 20:20:03 BST 2007


Is there a way to limit search result data, for example to only past 7
days or 30 days of documents that were created?

Thank you

On 05/04/07, Olly Betts <olly at survex.com> wrote:
> On Thu, Apr 05, 2007 at 09:55:36AM -0400, Ram Peters wrote:
> > I have fields in the database for title, description, and created_at.
> > I am using this to create document to be indexed.
> >
> > I want to sort the result in DESENDING order of CREATED_AT.  Do I do
> > this on database level, or after the result retrieved from the
> > database.  Do I have to manually sort them, using some sorting
> > algorithms?
>
> Add "created_at" as a value (Document::add_value()).
>
> Then you can sort them during the match - see
> Enquire::set_sort_by_value() (or set_sort_by_value_then_relevance() if
> multiple documents are likely to have the same value and you want to
> sort by relevance within groups with the same value).
>
> Cheers,
>     Olly
>



More information about the Xapian-discuss mailing list