olly at survex.com
Sun Nov 30 20:15:32 GMT 2008
On Fri, Nov 21, 2008 at 08:25:55AM +0000, Richard Boulton wrote:
> That's a good point, and I think the default implementation is probably in
> error. In practice, I suspect the posting sources we have implemented so
> far have all returned 0 for get_docid() in this situation (which isn't
> actually a valid docid). I can't easily see how to make the default
> posting source skip_to() do anything other than call get_docid(), because
> it can't know whether next() has been called yet at all, so perhaps the
> easiest fix is to document that posting sources should return 0 from
> get_docid() if the posting source iteration hasn't been started yet (ie,
> next(), skip_to() and check() haven't been called yet).
I think that's reasonable.
Tracking a "started" flag in the base class isn't really a good option
(it would mean next() would have to be proxied, adding overhead on every
The only other option I see is to lose the default implementation, which
is a pain if that's the best you can do for a particular subclass as
you'll have to write it yourself.
More information about the Xapian-discuss