org.apache.lucene.index.PointValues#estimateDocCount ( )源码实例Demo

下面列出了org.apache.lucene.index.PointValues#estimateDocCount ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lucene-solr   文件: TestLucene86PointsFormat.java
public void testDocCountEdgeCases() {
  PointValues values = getPointValues(Long.MAX_VALUE, 1, Long.MAX_VALUE);
  long docs = values.estimateDocCount(null);
  assertEquals(1, docs);
  values = getPointValues(Long.MAX_VALUE, 1, 1);
  docs = values.estimateDocCount(null);
  assertEquals(1, docs);
  values = getPointValues(Long.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE);
  docs = values.estimateDocCount(null);
  assertEquals(Integer.MAX_VALUE, docs);
  values = getPointValues(Long.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE / 2);
  docs = values.estimateDocCount(null);
  assertEquals(Integer.MAX_VALUE, docs);
  values = getPointValues(Long.MAX_VALUE, Integer.MAX_VALUE, 1);
  docs = values.estimateDocCount(null);
  assertEquals(1, docs);
}
 
源代码2 项目: lucene-solr   文件: TestLucene60PointsFormat.java
public void testDocCountEdgeCases() {
  PointValues values = getPointValues(Long.MAX_VALUE, 1, Long.MAX_VALUE);
  long docs = values.estimateDocCount(null);
  assertEquals(1, docs);
  values = getPointValues(Long.MAX_VALUE, 1, 1);
  docs = values.estimateDocCount(null);
  assertEquals(1, docs);
  values = getPointValues(Long.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE);
  docs = values.estimateDocCount(null);
  assertEquals(Integer.MAX_VALUE, docs);
  values = getPointValues(Long.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE / 2);
  docs = values.estimateDocCount(null);
  assertEquals(Integer.MAX_VALUE, docs);
  values = getPointValues(Long.MAX_VALUE, Integer.MAX_VALUE, 1);
  docs = values.estimateDocCount(null);
  assertEquals(1, docs);
}
 
源代码3 项目: lucene-solr   文件: TestLucene86PointsFormat.java
public void testRandomDocCount() {
  for (int i = 0; i < 100; i++) {
    long size = TestUtil.nextLong(random(), 1, Long.MAX_VALUE);
    int maxDoc = (size > Integer.MAX_VALUE) ? Integer.MAX_VALUE : Math.toIntExact(size);
    int docCount = TestUtil.nextInt(random(), 1, maxDoc);
    long estimatedPointCount = TestUtil.nextLong(random(), 0, size);
    PointValues values = getPointValues(size, docCount, estimatedPointCount);
    long docs = values.estimateDocCount(null);
    assertTrue(docs <= estimatedPointCount);
    assertTrue(docs <= maxDoc);
    assertTrue(docs >= estimatedPointCount / (size/docCount));
  }
}
 
源代码4 项目: lucene-solr   文件: TestLucene60PointsFormat.java
public void testRandomDocCount() {
  for (int i = 0; i < 100; i++) {
    long size = TestUtil.nextLong(random(), 1, Long.MAX_VALUE);
    int maxDoc = (size > Integer.MAX_VALUE) ? Integer.MAX_VALUE : Math.toIntExact(size);
    int docCount = TestUtil.nextInt(random(), 1, maxDoc);
    long estimatedPointCount = TestUtil.nextLong(random(), 0, size);
    PointValues values = getPointValues(size, docCount, estimatedPointCount);
    long docs = values.estimateDocCount(null);
    assertTrue(docs <= estimatedPointCount);
    assertTrue(docs <= maxDoc);
    assertTrue(docs >= estimatedPointCount / (size/docCount));
  }
}