Introduction to Lucene 3.6.2 (12) near-real-time search

Source: Internet
Author: User
Tags commit create index thread versions
Package com.jadyer.lucene;  
Import Java.io.File;  
      
Import java.io.IOException;  
Import Org.apache.lucene.analysis.standard.StandardAnalyzer;  
Import org.apache.lucene.document.Document;  
Import Org.apache.lucene.document.Field;  
Import Org.apache.lucene.index.IndexReader;  
Import Org.apache.lucene.index.IndexWriter;  
Import Org.apache.lucene.index.IndexWriterConfig;  
Import Org.apache.lucene.index.Term;  
Import Org.apache.lucene.search.IndexSearcher;  
Import Org.apache.lucene.search.NRTManager;  
Import Org.apache.lucene.search.NRTManagerReopenThread;  
Import Org.apache.lucene.search.Query;  
Import Org.apache.lucene.search.ScoreDoc;  
Import Org.apache.lucene.search.TermQuery;  
Import Org.apache.lucene.search.TopDocs;  
Import Org.apache.lucene.search.NRTManager.TrackingIndexWriter;  
Import Org.apache.lucene.store.Directory;  
Import Org.apache.lucene.store.FSDirectory;  
      
Import org.apache.lucene.util.Version; 
 /** * "Lucene3.6.2 Introduction Series" 12th section _ near-real-time search* @see Real Time Search (near-real-time)----> update the index immediately (Indexwriter.commit ()) * @see near-Real-time search------------------> Data changes as long as the data changes

, the index is saved in memory, and then a commit action is executed at a unified time for all indexes in memory * @see in order to achieve near-real-time search, LUCENE3.0 provides a way to reopen, and later versions provide two thread-safe classes Nrtmanager and Searchermanager * @see but these thread-safe classes are a bit different in the Lucene3.5 and 3.6 versions, and note that * @create Aug 7, 2013 4:19:58 PM * @aut  
    Hor Xuan Yu  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.