Java ReferenceManager类代码示例(javareferencemanager类的典型用法代码示例)

本文整理汇总了Java中org.apache.lucene.search.ReferenceManager的典型用法代码示例。如果您正苦于以下问题:Java ReferenceManager类的具体用法?Java ReferenceManager怎么用?Java ReferenceManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java ReferenceManager类代码示例(javareferencemanager类的典型用法代码示例)

ReferenceManager类属于org.apache.lucene.search包,在下文中一共展示了ReferenceManager类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: EngineConfig

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
/**
 * Creates a new {@link org.elasticsearch.index.engine.EngineConfig}
 */
public EngineConfig(OpenMode openMode, ShardId shardId, ThreadPool threadPool,
                    IndexSettings indexSettings, Engine.Warmer warmer, Store store, SnapshotDeletionPolicy deletionPolicy,
                    MergePolicy mergePolicy, Analyzer analyzer,
                    Similarity similarity, CodecService codecService, Engine.EventListener eventListener,
                    TranslogRecoveryPerformer translogRecoveryPerformer, QueryCache queryCache, QueryCachingPolicy queryCachingPolicy,
                    TranslogConfig translogConfig, TimeValue flushMergesAfter, ReferenceManager.RefreshListener refreshListeners,
                    long maxUnsafeAutoIdTimestamp) {
    if (openMode == null) {
        throw new IllegalArgumentException("openMode must not be null");
    }
    this.shardId = shardId;
    this.indexSettings = indexSettings;
    this.threadPool = threadPool;
    this.warmer = warmer == null ? (a) -> {} : warmer;
    this.store = store;
    this.deletionPolicy = deletionPolicy;
    this.mergePolicy = mergePolicy;
    this.analyzer = analyzer;
    this.similarity = similarity;
    this.codecService = codecService;
    this.eventListener = eventListener;
    codecName = indexSettings.getValue(INDEX_CODEC_SETTING);
    // We give IndexWriter a "huge" (256 MB) buffer, so it won't flush on its own unless the ES indexing buffer is also huge and/or
    // there are not too many shards allocated to this node.  Instead, IndexingMemoryController periodically checks
    // and refreshes the most heap-consuming shards when total indexing heap usage across all shards is too high:
    indexingBufferSize = new ByteSizeValue(256, ByteSizeUnit.MB);
    this.translogRecoveryPerformer = translogRecoveryPerformer;
    this.queryCache = queryCache;
    this.queryCachingPolicy = queryCachingPolicy;
    this.translogConfig = translogConfig;
    this.flushMergesAfter = flushMergesAfter;
    this.openMode = openMode;
    this.refreshListeners = refreshListeners;
    assert maxUnsafeAutoIdTimestamp >= IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP :
        "maxUnsafeAutoIdTimestamp must be >= -1 but was " + maxUnsafeAutoIdTimestamp;
    this.maxUnsafeAutoIdTimestamp = maxUnsafeAutoIdTimestamp;
} 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:41,代码来源:EngineConfig.java

示例2: setManager

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
/** Sync'd because we replace old mgr. */
synchronized void setManager(ReferenceManager<?> newMgr) {
    if (mgr != null) {
        mgr.removeListener(this);
    }
    mgr = newMgr;

    // In case InternalEngine closes & opens a new IndexWriter/SearcherManager, all deletes are made visible, so we clear old and
    // current here.  This is safe because caller holds writeLock here (so no concurrent adds/deletes can be happeninge):
    maps = new Maps();

    // So we are notified when reopen starts and finishes
    mgr.addListener(this);
} 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:LiveVersionMap.java

示例3: setManager

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
/** Sync'd because we replace old mgr. */
synchronized void setManager(ReferenceManager newMgr) {
    if (mgr != null) {
        mgr.removeListener(this);
    }
    mgr = newMgr;

    // In case InternalEngine closes & opens a new IndexWriter/SearcherManager, all deletes are made visible, so we clear old and
    // current here.  This is safe because caller holds writeLock here (so no concurrent adds/deletes can be happeninge):
    maps = new Maps();

    // So we are notified when reopen starts and finishes
    mgr.addListener(this);
} 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:LiveVersionMap.java

示例4: IndexerThread

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
public IndexerThread(IndexWriter w, FacetsConfig config, TaxonomyWriter tw,
    ReferenceManager<SearcherAndTaxonomy> mgr, int ordLimit, AtomicBoolean stop) {
  this.w = w;
  this.config = config;
  this.tw = tw;
  this.mgr = mgr;
  this.ordLimit = ordLimit;
  this.stop = stop;
} 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:TestSearcherTaxonomyManager.java

示例5: standard

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
public static SearcherManagerFactory standard()
{
    return new SearcherManagerFactory()
    {
        @Override
        public ReferenceManager<IndexSearcher> create( LuceneIndexWriter indexWriter ) throws IOException
        {
            return indexWriter.createSearcherManager();
        }
    };
} 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:12,代码来源:SearcherManagerFactories.java

示例6: isFieldsUnique

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
@Override
public boolean isFieldsUnique(String metaFieldId) {
    // Проверяем, что поля существуют
    final LuceneCriteriaHolder criteria = criteriaBuilder.createCriteria(
            retrieveTargetClass(),
            createCriteriaByIDs(Field.META_FIELD_ID, metaFieldId).injectSort(Field.VALUE, SortOrder.ASCENDING)
    );
    final int totalCount = queryProvider.executeCountByCriteria(criteria);
    if (totalCount <= 0) {
        return true;
    }
    // Выполняем итерирование значений полей пока не дойдем до конца или не встретим дублирующегося значения
    UniqueFieldHandler uniqueFieldHandler = new UniqueFieldHandler();
    try {
        LuceneQueryUtil.query(
                binderTransformer,
                new LuceneQueryCallback() {
                    @Override
                    public ReferenceManager<IndexSearcher> getSearcherManager() {
                        return refreshSearcherManager(false);
                    }

                    @Override
                    public LuceneQueryDescriptor getQueryDescriptor() {
                        return new LuceneQueryDescriptor(criteria.buildQuery(), criteria.buildSort(), criteria.buildFilter(), 0, totalCount);
                    }

                    @Override
                    public DocumentStoredFieldVisitor createStoredFieldVisitor() {
                        return new DocumentStoredFieldVisitor();
                    }
                },
                uniqueFieldHandler
        );
        return uniqueFieldHandler.isUnique();
    } catch (IOException ex) {
        throw new RuntimeException(String.format("Can't find unique fields '%s' index. Cause by: %s", retrieveTargetClassName(), ex.getMessage()), ex);
    }
} 
开发者ID:hflabs,项目名称:perecoder,代码行数:40,代码来源:FieldService.java

示例7: getRefreshListeners

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
/**
 * {@linkplain ReferenceManager.RefreshListener} instance to configure.
 */
public ReferenceManager.RefreshListener getRefreshListeners() {
    return refreshListeners;
} 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:EngineConfig.java

示例8: config

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
public EngineConfig config(IndexSettings indexSettings, Store store, Path translogPath, MergePolicy mergePolicy,
                           long maxUnsafeAutoIdTimestamp, ReferenceManager.RefreshListener refreshListener) {
    return config(indexSettings, store, translogPath, mergePolicy, createSnapshotDeletionPolicy(),
                  maxUnsafeAutoIdTimestamp, refreshListener);
} 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:InternalEngineTests.java

示例9: testTryDeleteDocument

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
public void testTryDeleteDocument ()
  throws IOException
{
  Directory directory = createIndex();

  IndexWriter writer = getWriter(directory);

  ReferenceManager<IndexSearcher> mgr = new SearcherManager(writer,
                                                            true,
                                                            new SearcherFactory());

  TrackingIndexWriter mgrWriter = new TrackingIndexWriter(writer);

  IndexSearcher searcher = mgr.acquire();

  TopDocs topDocs = searcher.search(new TermQuery(new Term("foo", "0")),
                                    100);
  assertEquals(1, topDocs.totalHits);

  long result;
  if (random().nextBoolean()) {
    IndexReader r = DirectoryReader.open(writer, true);
    result = mgrWriter.tryDeleteDocument(r, 0);
    r.close();
  } else {
    result = mgrWriter.tryDeleteDocument(searcher.getIndexReader(), 0);
  }

  // The tryDeleteDocument should have succeeded:
  assertTrue(result != -1);

  assertTrue(writer.hasDeletions());

  if (random().nextBoolean()) {
    writer.commit();
  }

  assertTrue(writer.hasDeletions());
  
  mgr.maybeRefresh();

  searcher = mgr.acquire();

  topDocs = searcher.search(new TermQuery(new Term("foo", "0")), 100);

  assertEquals(0, topDocs.totalHits);
} 
开发者ID:europeana,项目名称:search,代码行数:48,代码来源:TestTryDelete.java

示例10: Wrap

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
Wrap( ReferenceManager<G> delegate )
{

    this.delegate = delegate;
} 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:6,代码来源:LuceneIndexAccessor.java

示例11: testDeleteDocuments

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
public void testDeleteDocuments ()
  throws IOException
{
  Directory directory = createIndex();

  IndexWriter writer = getWriter(directory);

  ReferenceManager<IndexSearcher> mgr = new SearcherManager(writer,
                                                            true,
                                                            new SearcherFactory());

  IndexSearcher searcher = mgr.acquire();

  TopDocs topDocs = searcher.search(new TermQuery(new Term("foo", "0")),
                                    100);
  assertEquals(1, topDocs.totalHits);

  TrackingIndexWriter mgrWriter = new TrackingIndexWriter(writer);
  long result = mgrWriter.deleteDocuments(new TermQuery(new Term("foo",
                                                                 "0")));

  assertEquals(1, result);

  // writer.commit();

  assertTrue(writer.hasDeletions());

  mgr.maybeRefresh();

  searcher = mgr.acquire();

  topDocs = searcher.search(new TermQuery(new Term("foo", "0")), 100);

  assertEquals(0, topDocs.totalHits);
} 
开发者ID:europeana,项目名称:search,代码行数:36,代码来源:TestTryDelete.java

示例12: testTryDeleteDocumentCloseAndReopen

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
public void testTryDeleteDocumentCloseAndReopen ()
  throws IOException
{
  Directory directory = createIndex();

  IndexWriter writer = getWriter(directory);

  ReferenceManager<IndexSearcher> mgr = new SearcherManager(writer,
                                                            true,
                                                            new SearcherFactory());

  IndexSearcher searcher = mgr.acquire();

  TopDocs topDocs = searcher.search(new TermQuery(new Term("foo", "0")),
                                    100);
  assertEquals(1, topDocs.totalHits);

  TrackingIndexWriter mgrWriter = new TrackingIndexWriter(writer);
  long result = mgrWriter.tryDeleteDocument(DirectoryReader.open(writer,
                                                                 true), 0);

  assertEquals(1, result);

  writer.commit();

  assertTrue(writer.hasDeletions());

  mgr.maybeRefresh();

  searcher = mgr.acquire();

  topDocs = searcher.search(new TermQuery(new Term("foo", "0")), 100);

  assertEquals(0, topDocs.totalHits);

  writer.close();

  searcher = new IndexSearcher(DirectoryReader.open(directory));

  topDocs = searcher.search(new TermQuery(new Term("foo", "0")), 100);

  assertEquals(0, topDocs.totalHits);

} 
开发者ID:europeana,项目名称:search,代码行数:45,代码来源:TestTryDelete.java

示例13: create

import org.apache.lucene.search.ReferenceManager; //导入依赖的package包/类
ReferenceManager<IndexSearcher> create( LuceneIndexWriter indexWriter ) throws IOException; 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:2,代码来源:SearcherManagerFactory.java

本文标签属性:

示例:示例的拼音

代码:代码是什么

java:java面试题

ReferenceManager:ReferenceManager

上一篇:Java UIComponent.getCompositeComponentParent方法代码示例
下一篇:佩茨科夫为啥老是照片(俄罗斯总统发言人佩斯科夫为什么从不直面镜头?)

为您推荐