• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LeafCollector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getInsanityWrapper

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
private Collector getInsanityWrapper(final String field, Collector collector) {
  SchemaField sf = searcher.getSchema().getFieldOrNull(field);
  if (sf != null && !sf.hasDocValues() && !sf.multiValued() && sf.getType().getNumberType() != null) {
    // it's a single-valued numeric field: we must currently create insanity :(
    // there isn't a GroupedFacetCollector that works on numerics right now...
    return new FilterCollector(collector) {
      @Override
      public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
        LeafReader insane = Insanity.wrapInsanity(context.reader(), field);
        return in.getLeafCollector(insane.getContext());
      }
    };
  } else {
    return collector;
  }
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:17,代码来源:SimpleFacets.java


示例2: getLeafCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
@Override
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
    return new LeafCollector() {

        // ignore scorer
        public void setScorer(Scorer scorer) throws IOException {
        }

        public void collect(int doc) throws IOException {
            Document document = searcher.doc(doc, field);
            String fieldValue = document.get(fieldName);
            addData(fieldValue);
        }

    };
}
 
开发者ID:jenkinsci,项目名称:lucene-search-plugin,代码行数:17,代码来源:DistinctCollector.java


示例3: getLeafCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
@Override
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
    if (cancelled.get()) {
        throw new TaskCancelledException("cancelled");
    }
    if (leafLevel) {
        return new CancellableLeafCollector(super.getLeafCollector(context));
    } else {
        return super.getLeafCollector(context);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:CancellableCollector.java


示例4: getLeafCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
@Override
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
    final Scorer filterScorer = filter.scorer(context);
    final LeafCollector in = collector.getLeafCollector(context);
    final Bits bits = Lucene.asSequentialAccessBits(context.reader().maxDoc(), filterScorer);

    return new FilterLeafCollector(in) {
        @Override
        public void collect(int doc) throws IOException {
            if (bits.get(doc)) {
                in.collect(doc);
            }
        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:FilteredCollector.java


示例5: testLowLevelCancellableCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
public void testLowLevelCancellableCollector() throws IOException {
    TotalHitCountCollector collector = new TotalHitCountCollector();
    AtomicBoolean cancelled = new AtomicBoolean();
    CancellableCollector cancellableCollector = new CancellableCollector(cancelled::get, true, collector);
    final LeafCollector leafCollector = cancellableCollector.getLeafCollector(reader.leaves().get(0));
    leafCollector.collect(0);
    cancelled.set(true);
    expectThrows(TaskCancelledException.class, () -> leafCollector.collect(1));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:SearchCancellationTests.java


示例6: testCancellableCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
public void testCancellableCollector() throws IOException {
    TotalHitCountCollector collector = new TotalHitCountCollector();
    AtomicBoolean cancelled = new AtomicBoolean();
    CancellableCollector cancellableCollector = new CancellableCollector(cancelled::get, false, collector);
    final LeafCollector leafCollector = cancellableCollector.getLeafCollector(reader.leaves().get(0));
    leafCollector.collect(0);
    cancelled.set(true);
    leafCollector.collect(1);
    expectThrows(TaskCancelledException.class, () -> cancellableCollector.getLeafCollector(reader.leaves().get(1)));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:SearchCancellationTests.java


示例7: testCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
public void testCollector() throws IOException {
    TotalHitCountCollector collector = new TotalHitCountCollector();
    ProfileCollector profileCollector = new ProfileCollector(collector);
    assertEquals(0, profileCollector.getTime());
    final LeafCollector leafCollector = profileCollector.getLeafCollector(reader.leaves().get(0));
    assertThat(profileCollector.getTime(), greaterThan(0L));
    long time = profileCollector.getTime();
    leafCollector.setScorer(null);
    assertThat(profileCollector.getTime(), greaterThan(time));
    time = profileCollector.getTime();
    leafCollector.collect(0);
    assertThat(profileCollector.getTime(), greaterThan(time));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:QueryProfilerTests.java


示例8: getLeafCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
@Override
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
    final SortedDocValues values = globalIfd.load(context).getOrdinalsValues(parentType);
    if (values == null) {
        throw new CollectionTerminatedException();
    }
    return new LeafCollector() {
        Scorer scorer;
        @Override
        public void setScorer(Scorer scorer) throws IOException {
            this.scorer = scorer;
        }
        @Override
        public void collect(int doc) throws IOException {
            long globalOrdinal = values.getOrd(doc);
            if (globalOrdinal != SortedSetDocValues.NO_MORE_ORDS) {
                long parentIdx = parentIdxs.add(globalOrdinal);
                if (parentIdx >= 0) {
                    scores = bigArrays.grow(scores, parentIdx + 1);
                    scores.set(parentIdx, scorer.score());
                } else {
                    assert false : "parent id should only match once, since there can only be one parent doc";
                }
            }
        }
    };
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:28,代码来源:ParentQuery.java


示例9: CancellableLeafCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
private CancellableLeafCollector(LeafCollector in) {
    super(in);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:CancellableCollector.java


示例10: getLeafCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
@Override
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
    return collector.getLeafCollector(context);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:InternalProfileCollector.java


示例11: getLeafCollector

import org.apache.lucene.search.LeafCollector; //导入依赖的package包/类
@Override
public LeafCollector getLeafCollector(
		LeafReaderContext paramLeafReaderContext) throws IOException {
	return this;
}
 
开发者ID:ksgwr,项目名称:LuceneDB,代码行数:6,代码来源:ExactCollector.java



注:本文中的org.apache.lucene.search.LeafCollector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PieModel类代码示例发布时间:2022-05-22
下一篇:
Java FixedPrioritiesPriorityQueue类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap