當前位置: 首頁>>代碼示例>>Java>>正文


Java SearcherManager.acquire方法代碼示例

本文整理匯總了Java中org.apache.lucene.search.SearcherManager.acquire方法的典型用法代碼示例。如果您正苦於以下問題:Java SearcherManager.acquire方法的具體用法?Java SearcherManager.acquire怎麽用?Java SearcherManager.acquire使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.lucene.search.SearcherManager的用法示例。


在下文中一共展示了SearcherManager.acquire方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readLastCommittedSegmentInfos

import org.apache.lucene.search.SearcherManager; //導入方法依賴的package包/類
/**
 * Read the last segments info from the commit pointed to by the searcher manager
 */
protected static SegmentInfos readLastCommittedSegmentInfos(final SearcherManager sm, final Store store) throws IOException {
    IndexSearcher searcher = sm.acquire();
    try {
        IndexCommit latestCommit = ((DirectoryReader) searcher.getIndexReader()).getIndexCommit();
        return Lucene.readSegmentInfos(latestCommit);
    } catch (IOException e) {
        // Fall back to reading from the store if reading from the commit fails
        try {
            return store.readLastCommittedSegmentsInfo();
        } catch (IOException e2) {
            e2.addSuppressed(e);
            throw e2;
        }
    } finally {
        sm.release(searcher);
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:21,代碼來源:Engine.java

示例2: readLastCommittedSegmentInfos

import org.apache.lucene.search.SearcherManager; //導入方法依賴的package包/類
/**
 * Read the last segments info from the commit pointed to by the searcher manager
 */
protected static SegmentInfos readLastCommittedSegmentInfos(final SearcherManager sm, final Store store) throws IOException {
    IndexSearcher searcher = sm.acquire();
    try {
        IndexCommit latestCommit = ((DirectoryReader) searcher.getIndexReader()).getIndexCommit();
        return Lucene.readSegmentInfos(latestCommit);
    } catch (IOException e) {
        // Fall back to reading from the store if reading from the commit fails
        try {
            return store. readLastCommittedSegmentsInfo();
        } catch (IOException e2) {
            e2.addSuppressed(e);
            throw e2;
        }
    } finally {
        sm.release(searcher);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:21,代碼來源:Engine.java

示例3: findWave

import org.apache.lucene.search.SearcherManager; //導入方法依賴的package包/類
@Override
public Digest findWave(WaveId waveId, ParticipantId viewer) {
  TermQuery query = new TermQuery(new Term(IndexCondition.Field.WAVE_ID.toString(), waveId.serialise()));
  SearcherManager searcherManager = nrtManager.getSearcherManager(true);
  IndexSearcher indexSearcher = searcherManager.acquire();
  try {
    TopDocs hints = indexSearcher.search(query, 1);
    if (hints.totalHits != 0) {
      ScoreDoc hint = hints.scoreDocs[0];
      return parseDigest(indexSearcher.doc(hint.doc), null);
    }
  } catch (IOException ex) {
    LOG.log(Level.SEVERE, "Search wave " + waveId.serialise() + " failed", ex);
  }
  return null;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:17,代碼來源:LuceneSearchImpl.java

示例4: FullTextCursor

import org.apache.lucene.search.SearcherManager; //導入方法依賴的package包/類
public FullTextCursor(QueryContext context, HKeyRowType rowType, 
                      SearcherManager searcherManager, Query query, int limit) {
    this.context = context;
    this.rowType = rowType;
    this.searcherManager = searcherManager;
    this.query = query;
    this.limit = limit;
    //adapter = context.getStore();
    searcher = searcherManager.acquire();
}
 
開發者ID:jaytaylor,項目名稱:sql-layer,代碼行數:11,代碼來源:FullTextCursor.java

示例5: LuceneKVSIterator

import org.apache.lucene.search.SearcherManager; //導入方法依賴的package包/類
/**
 * constructor
 * @param manager lucene searcher manager
 * @param parent parent map
 * @throws IOException IOException
 */
public LuceneKVSIterator(SearcherManager manager, LuceneKVSBase<K, V> parent) throws IOException {
	this.manager = manager;
	this.parent = parent;

	manager.maybeRefreshBlocking();

	searcher = manager.acquire();
	reader = searcher.getIndexReader();
	maxDoc = reader.maxDoc();
	size = reader.numDocs();
	docCount = 0;
	entryCount = 0;
}
 
開發者ID:ksgwr,項目名稱:LuceneDB,代碼行數:20,代碼來源:LuceneKVSIterator.java

示例6: testSearcherManager

import org.apache.lucene.search.SearcherManager; //導入方法依賴的package包/類
@Test
public void testSearcherManager() throws IOException {
    SearcherManager searcherManager = new SearcherManager(indexWriter.getDirectory(), new SearcherFactory());
    IndexSearcher indexSearcher = null;
    try {
        indexSearcher = searcherManager.acquire();
    }
    finally {
        if (indexSearcher == null) {
            searcherManager.release(indexSearcher);
        }
    }
}
 
開發者ID:xuzhikethinker,項目名稱:t4f-data,代碼行數:14,代碼來源:AosManagerTest.java


注:本文中的org.apache.lucene.search.SearcherManager.acquire方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。