[Xapian-discuss] Re: Fetching a list of doc-id's from a database

Olly Betts olly at survex.com
Thu Oct 27 14:53:03 BST 2005


On Wed, Oct 26, 2005 at 12:39:20PM +0200, Eric Bus wrote:
> Eric Bus wrote:
> >Is it possible to fetch a list of document ID's from a Xapian database? 
> 
> Sorry, I ment uniqueID's. Document ID's are something completely 
> different ;)
> 
> I have a list of primary keys in my database and I want to match this 
> with the primary keys in the Xapian Flint database.

So you want to find all terms with prefix "Q" (or similar) in a
database?

If so, yes it's very easy - like so:

    Xapian::TermIterator t = db.allterms_begin();
    t.skip_to("Q");
    while (t != db.allterms_end()) {
	string unique_id = *t;
	if (unique_id[0] != 'Q') break;
	// Process unique_id
    }

Cheers,
    Olly



More information about the Xapian-discuss mailing list