[Xapian-devel] Iterators

Olly Betts olly at survex.com
Mon May 21 02:30:18 BST 2012


On Thu, May 17, 2012 at 09:04:10AM +0400, Michael Uvarov wrote:
> I just use another iterator and move in the beginning of it with
> skip_to(first_term_name);  // Can first_term_name be just ""?

You should be able to do skip_to("") on a TermIterator with no effect.
If it's the common case that first_term_name will be empty, then it's
probably worth checking for it to avoid the overhead of the no-op call:

    if (!first_term_name.empty())
	it.skip_to(first_term_name);

> It allows to use one class for term iteration both for ValueCountMatchSpy
> and Document.

Not sure I follow why this makes a difference...

Cheers,
    Olly



More information about the Xapian-devel mailing list