[Xapian-discuss] Printing all records when search is not present

Olly Betts olly at survex.com
Tue Jan 11 12:49:30 GMT 2011


On Tue, Dec 28, 2010 at 05:30:34PM -0500, Shripad Bodas wrote:
> I want to print all the records from the passed database when the
> search string is not present. I quickly skimmed through the API but I
> couldn't find a way to do it. Can someone show some pointers.

Just use Xapian::Query::MatchAll and AND_NOT.  So if q is the Query object
from parsing your search string:

Xapian::Query all_but_q(Xapian::Query::AND_NOT, Xapian::Query::MatchAll, q);

MatchAll is very efficient if there are no gaps in the docid numbering.
If that isn't the case, it's more efficient with chert (default backend
in Xapian 1.2) than with flint (default backend in 1.0).

Cheers,
    Olly



More information about the Xapian-discuss mailing list