Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lucene indexing and searching at the same time

I want to search with Lucene on an index. The index is changed frequently. So I need to do something to search and index at the same time. It's a web application on Tomcat. And I want to use RAMDeirectory to increase the searching speed. I don't know how to do it!

like image 906
Ali Hashemi Avatar asked Feb 13 '12 06:02

Ali Hashemi


People also ask

How does Lucene index search work?

Simply put, Lucene uses an “inverted indexing” of data – instead of mapping pages to keywords, it maps keywords to pages just like a glossary at the end of any book. This allows for faster search responses, as it searches through an index, instead of searching through text directly.

Why is Lucene so fast?

Why is Lucene faster? Lucene is very fast at searching for data because of its inverted index technique. Normally, datasources structure the data as an object or record, which in turn have fields and values.

Is Lucene still used?

First written in 1999 by Doug Cutting, still going strong... Apache Lucene, the full-text search library, has operated and been maintained for more than 20 years and for many developers is an integral part of their website and application builds.


1 Answers

NRTManager in the misc Lucene package provides the ability to search and index at the same time.

TrackingIndexWriter writer; // your writer
SearcherFactory factory = new SearcherFactory();
NRTManager mgr = new NRTManager(writer, factory);

Check NRTManager methods for more info.

like image 182
Shady Avatar answered Oct 04 '22 18:10

Shady