Why Lucene doesn't support any type of update to an existing document

ぃ、小莉子 提交于 2019-12-01 01:47:29

问题


My use case involves index a Lucene document, then on multiple future occasions add terms that point to this existing doc, that's without deleting and re-adding the entire document for each new term (because of performance, and not keeping the original terms).

I do know that a document can not be truly updated. My question is why?

Or more precisely, why are all forms of updates (terms, stored fields) not supported?
Why it's not possible to add another term to point to an existing document - technically: isn't all that's needed is to have the existing doc Id placed in the posting list of the term. Why is that hard? Is there some immutable statistics that are in the way?

Are there any workarounds for supporting my usecase of adding a term (indexed field) to an existing doc?


回答1:


I do know that a document can not be truly updated. My question is why?

Gili, editing a document will cause changes in the related terms postings and this is problematic due to to the terms posting-list structure. The posting-list is sorted and stored sequential in memory. Thus to add a document to a term's posting-list you have to give it a higher doc id this is done by deleting and re-index the entire document.



来源:https://stackoverflow.com/questions/12185406/why-lucene-doesnt-support-any-type-of-update-to-an-existing-document

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!