[Xapian-devel] search on subsets

Olly Betts olly at survex.com
Fri Apr 7 01:40:59 BST 2006


On Thu, Apr 06, 2006 at 04:17:44PM -0700, Alexander Lind wrote:
> i want to add a feature so that you can search within a search - search 
> on a subset.
> 
> i haven't yet started working on it, but as far as i can tell, there 
> seems to be no easy way of doing this.

If the original query is orig_query and the new query is new_query then
"search for new_query within the results of orig_query" is:

    Query(Query::OP_FILTER, new_query, orig_query)

If it's soon after "orig_query" was run then that should be efficient
too, since the Btree blocks used for the original query will be cached.

It's not possible to do it more directly - Xapian's matcher does the
minimum amount of work possible, so if you ask for 10 hits it stops
after it's sure it has the best 10 - the complete set of matches isn't
calculated so it doesn't make sense to save it to be searched within.

Cheers,
    Olly



More information about the Xapian-devel mailing list