[Xapian-discuss] Get Document Position in Search

Ryan Bates ryan at railscasts.com
Thu Jul 9 21:52:08 BST 2009


Apologies if this has been asked before, but I couldn't find it with some
Googling.
Is there any way to determine the position of a given document in a search
result without fetching all records?

This would be useful for implementing a previous/next record functionality
in a website. I'm assuming this would be done through an Enquire since that
contains the query and sorting information. Here's an example of what I'm
looking for.

position = enquire.position_of_document(some_doc)
previous = enquire.mset(position-1, 1)
next = enquire.mset(position+1, 1)

That is using Ruby bindings but any code sample will do. I'm mainly just
wondering if this functionality exists. If not, is there an alternative way
to fetch the previous/next document in a result set?

Thanks,

Ryan


More information about the Xapian-discuss mailing list