lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <yo...@apache.org>
Subject Re: Payload API
Date Mon, 19 Nov 2007 19:21:31 GMT
On Nov 19, 2007 2:03 PM, Michael McCandless <lucene@mikemccandless.com> wrote:
> Maybe you mean that each Token must be fully independent because there
> are plenty of filters that hold onto each Token long after next() is
> called again, and then serve them up again later

Yes.

> But this is why we have the Token next() method (which returns a
> "stable" Token that the callee can't change later) vs the Token
> next(Token) method which allows the callee to re-use the passed in
> Token on the next call.

Right...  that works great for termBuffer, but the difference is that
Token owns the termBuffer (contents are always copied into it).

> So eg in TokenStream.next() base implementation we would have to make
> a new copy of the payload byte[] and set it in the copied token.  This
> way when a caller calls next() they get a full private copy, even of
> the by-reference payload.

Perhaps I'm the one missing something, but it still doesn't seem like
this works a filter can set the reference to the byte[] and is allowed
to reuse it.  The particular filter setting the payload is in control,
not next().

-Yonik

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message