当前位置: 首页>>代码示例>>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;未经允许,请勿转载。