lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Svensson <>
Subject Re: How to handle change to index definition?
Date Wed, 10 Jun 2015 12:09:36 GMT

You'll need to reindex all those old documents, either using 
IndexWriter.UpdateDocument for every document, or as you describe using 
IndexWriter.DeleteAll and reindex everything. Do you need incremental 
reindexing, or can you accept doing a complete reindex at once?

No matter how you do it your index will end up with a lot of documents 
marked as deleted, and the new versions of those documents. The deleted 
documents will not be returned by searches, but they occupy disk space. 
They can be removed using IndexWriter.ExpungeDeletes, or you could 
optimize your index which would also remove them.

// Simon

On 10/06/15 14:00, Andrew Stephens wrote:
> Let’s say I’ve been writing documents to the index for some time, then 
> I decide to make a change to the index. This could be adding or 
> removing a field, or changing how one of the fields is configured 
> (e.g. changing the Field.Store or Field.Index parameter).
> Assuming that I need this change to apply to old documents, is the 
> only course of action to delete the index then add all the documents 
> from scratch? And is “_writer.DeleteAll()” sufficient or would I need 
> to delete the FS directory?
> (I’ve used RavenDB in the past, which is built on Lucene, and that 
> detects when you’ve changed the index definition, and applies the 
> changes. I presume it must be doing something similar, i.e. deleting 
> and recreating the index on a background thread).
> AndrewStephens | Senior Software Engineer
> <> 	
> T: +44 (0) 1978 661304  |  F: +44 (0) 1978 664301  |
>   W: <>
> Unit 74 Clywedog Road South, Wrexham Industrial Estate, Wrexham,  LL13 
> 9XS | Nu Instruments Ltd is registered in England, No.: 3046042. 
> Registered Office: Seacourt Tower, West Way, Oxford OX2 0FB. VAT No.: 
> GB 616 3733 45
> This message is confidential and may contain privileged information 
> and is protected by copyright. If you are not the intended recipient 
> you should not copy or disclose this message to anyone but should 
> kindly notify the sender and delete the message. Opinions, conclusions 
> and other information in this message which do not relate to the 
> official business of Nu Instruments Ltd shall be understood as neither 
> given nor endorsed by it. Neither the Company nor the sender accepts 
> any responsibility or liability for any loss or damage arising from 
> the presence of any computer virus or similar harmful code contained 
> in this email or attachment/s.  It is your responsibility to scan this 
> email and any attachments. The Company reserves the right to access 
> and disclose all messages sent over its email system.

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