Lucene 索引多久更新一次?
频繁更新 lucene 索引是否可以(每隔几秒)?更新将同样是添加,并且更新和搜索将同时发生。
Is it ok to update a lucene index frequently (every few seconds)? The updates will equally be adds and updates and searching will be happening at the same time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将在这个答案前面加上“我只使用过 Java Lucene”,但这应该仍然适用:从一般意义上讲,执行您所描述的操作当然没问题。您会发现 Lucene 在您的目录中创建了许多额外的索引文件,这些文件负责每次添加和更新。这些将被透明地搜索。当然,随着时间的推移,如果附加文件的数量变得太大,您的搜索性能将会下降。这是您需要运行优化的时候,优化可能非常快或非常慢,具体取决于索引的大小。
归根结底,很难有人评论你的性能如何,以及你应该多久优化一次,不过,我可以说 Lucene 将从根本上处理你想要做的事情。
I'll prefix this answer with "I've only used Java Lucene", but this should still all apply: It's certainly fine to do what you're describing, in a general sense. What you'll find is that Lucene creates a lot of additional index files in your directory, which account for each add and update. These will be searched transparently. Naturally, over time if this number of additonal files becomes too large, your search performance will degrade. This is when you need to run an optimise, which can be extremely fast or extremely slow, depending on the size of your index.
At the end of the day, it's hard for anyone to comment on how your performance will be, and how frequently you should optimise, nevertheless, I can say that Lucene will handle fundamentally what you're trying to do.
只要您使用 NRT 就可以了。 (单例索引编写器。)
This is fine as long as you use NRT. (Singleton IndexWriter.)