简体   繁体   中英

How to handle relationship updates in Lucene.net?

I'm developing an application that uses Lucene.net, and there's a use case I don't know how to handle. Let's say I have 'books' and 'authors', which correspond to 2 different tables and objects. If I create an author "John Doe" and then create a book, I will also index the author for that book; that allows me do a search like "title author:Doe", and it will return all books.

Now let's say I go and rename the author to something else, all books will be OK in the database since there's a FK relationship. In Lucene however, the books will be outdated since they contain the name of the author as text.

How can I handle those cases? I guess Lucene doesn't have FK constraints or things like that.

(Note: tagged as Java because Lucene and Lucene.net are pretty similar)

不幸的是,在Lucene中,如果更改一个Lucene文档中的索引数据,则需要更改其他Lucene文档中的相应索引数据-2.9.x中的Lucene不支持任何UPDATE功能(您必须添加和删除每个文献)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM