Ram Peters
2007-Apr-05 14:55 UTC
[Xapian-discuss] How does the sorting of search result work in Xapian?
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? Thank you.
Olly Betts
2007-Apr-05 14:59 UTC
[Xapian-discuss] How does the sorting of search result work in Xapian?
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
Ram Peters
2007-Apr-05 20:20 UTC
[Xapian-discuss] How does the sorting of search result work in Xapian?
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@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 >