You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Wei Wang <we...@gmail.com> on 2013/04/07 08:41:48 UTC
Reuse Document
Lucene encourages to re-use Document by setting new values for Fields
contained within a Document object. This assumes there is no change to the
number and types of Fields contained in a Document object during indexing.
If the number and types of Fields contained in a Document object changes
from time to time, is it possible to remove all Field at once using
function similar to clear() for Collection object? In this way we can at
least reuse the Document object. It is inconvenient to use removeField()
and removeFields() since it requires enumerating field names.
Thanks.
Re: Reuse Document
Posted by Wei Wang <we...@gmail.com>.
As long as it is cheap to create a Document object, it would be fine. I
guess we will probably always create new Document in such case.
On Sun, Apr 7, 2013 at 5:31 AM, Michael McCandless <
lucene@mikemccandless.com> wrote:
> Document doesn't have any way to clear all fields today ... but,
> likely this wouldn't really buy you much performance if it did vs just
> creating a new Document when the fields changed.
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
> On Sun, Apr 7, 2013 at 2:41 AM, Wei Wang <we...@gmail.com> wrote:
> > Lucene encourages to re-use Document by setting new values for Fields
> > contained within a Document object. This assumes there is no change to
> the
> > number and types of Fields contained in a Document object during
> indexing.
> >
> > If the number and types of Fields contained in a Document object changes
> > from time to time, is it possible to remove all Field at once using
> > function similar to clear() for Collection object? In this way we can at
> > least reuse the Document object. It is inconvenient to use removeField()
> > and removeFields() since it requires enumerating field names.
> >
> > Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: Reuse Document
Posted by Michael McCandless <lu...@mikemccandless.com>.
Document doesn't have any way to clear all fields today ... but,
likely this wouldn't really buy you much performance if it did vs just
creating a new Document when the fields changed.
Mike McCandless
http://blog.mikemccandless.com
On Sun, Apr 7, 2013 at 2:41 AM, Wei Wang <we...@gmail.com> wrote:
> Lucene encourages to re-use Document by setting new values for Fields
> contained within a Document object. This assumes there is no change to the
> number and types of Fields contained in a Document object during indexing.
>
> If the number and types of Fields contained in a Document object changes
> from time to time, is it possible to remove all Field at once using
> function similar to clear() for Collection object? In this way we can at
> least reuse the Document object. It is inconvenient to use removeField()
> and removeFields() since it requires enumerating field names.
>
> Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org