lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Diehl <m...@gooddiehl.net.INVALID>
Subject Lucene 4.8 - Reusing Document during indexing
Date Sun, 11 Jun 2017 02:56:46 GMT
Hi,

I am not understanding how to reuse Document like we could in 3.0.3 for
indexing purposes.

For instance, in 3.0.3, I could create and then set several common Field
values, and then just iterate changing a single field in the Document, and
add to index:

Document lucenedoc = createDocumentAndSetFileSpecificFields( file );

foreach ( var block in blocks )
{
        luceneDoc.GetField( "text" ).SetValue( block.Text );
        indexWriter.AddDocument( luceneDoc );
}

In 4.8, SetValue is not a function anymore, and it seems like I have to
recreate my 8-field Document every time I write to Index.

foreach ( var block in blocks )
{
    Document lucenedoc = createDocumentAndSetFileSpecificFields( file,
block.Text );
    indexWriter.AddDocument( luceneDoc );
}

Can someone help me realize what I am missing?

Thanks,
Matt

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message