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.
我正在开发一个使用Lucene.net的应用程序,并且有一个我不知道如何处理的用例。假设我有“书籍”和“作者”,它们对应于2个不同的表格和对象。如果我创建一个作者“John Doe”然后创建一本书,我也会为该书的作者编制索引;这允许我做一个像“标题作者:Doe”的搜索,它将返回所有书籍。
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.
现在让我们说我将作者重命名为其他内容,因为存在FK关系,所有书籍都可以在数据库中使用。然而,在Lucene中,书籍将过时,因为它们包含作者的文字名称。
How can I handle those cases? I guess Lucene doesn't have FK constraints or things like that.
我该如何处理这些案件?我猜Lucene没有FK限制或类似的东西。
(Note: tagged as Java because Lucene and Lucene.net are pretty similar)
(注意:标记为Java,因为Lucene和Lucene.net非常相似)
1 个解决方案
#1
0
Unfortunately in Lucene, if you change the data indexed in one Lucene document, you need to change that corresponding indexed data in the other Lucene documents -- and Lucene in 2.9.x did not support any UPDATE capabilities (you have to add & delete each document).
不幸的是,在Lucene中,如果您更改一个Lucene文档中索引的数据,则需要更改其他Lucene文档中的相应索引数据 - 而2.9.x中的Lucene不支持任何UPDATE功能(您必须添加和删除每个文献)。
#1
0
Unfortunately in Lucene, if you change the data indexed in one Lucene document, you need to change that corresponding indexed data in the other Lucene documents -- and Lucene in 2.9.x did not support any UPDATE capabilities (you have to add & delete each document).
不幸的是,在Lucene中,如果您更改一个Lucene文档中索引的数据,则需要更改其他Lucene文档中的相应索引数据 - 而2.9.x中的Lucene不支持任何UPDATE功能(您必须添加和删除每个文献)。