NotDan
NotDan

Reputation: 32213

How often can I update a Lucene index?

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.

Upvotes: 2

Views: 504

Answers (2)

Xodarap
Xodarap

Reputation: 11849

This is fine as long as you use NRT. (Singleton IndexWriter.)

Upvotes: 1

AdamH
AdamH

Reputation: 2201

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.

Upvotes: 5

Related Questions