Lucene real-time indexing?
What is the best wa开发者_Python百科y to achieve Lucene real-time indexing?
Lucene has a feature called near-real-time search to address exactly this need.
It requires that your IndexReader is in the same JVM as your IndexWriter.
You make changes with the IndexWriter, and then open a reader directly from the writer using IndexReader.open(writer), or on older Lucene releases writer.getReader(). This call will normally be very fast (in proportion to how many changes you've made since last opening a reader) as it bypasses the costly commit normally required for opening a reader. It's able to search the un-committed changes in the writer.
This reader still searches a point-in-time snapshot from the writer, ie all changes as of when you opened it.
Obtain an index reader from the index writer.
Update: Looks like the current method is to open a directory reader using an index writer object.
Try Zoie
http://sna-projects.com/zoie/
The Lucene wiki has some information: http://wiki.apache.org/lucene-java/NearRealtimeSearch
SolrCloud looks promising. It is still very new, but will provide distributed Solr indexing in the NoSQL spirit.
精彩评论