Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexReader.numDocs()


  }

  public int getNumDocs() {
    IndexReader reader=IndexReaderFactoryUtils.getIndexReader(indexFactory);
    try {
      return reader.numDocs();
    } finally {
      IndexReaderFactoryUtils.releaseIndexReader(indexFactory,reader);
    }
  }
View Full Code Here


       
    String minIP = pad(minId);
    String maxIP = pad(maxId);
    String medIP = pad(medId);
   
    int numDocs = reader.numDocs();
       
    assertEquals("num of docs", numDocs, 1+ maxId - minId);
       
    ScoreDoc[] result;
    Query q = new TermQuery(new Term("body","body"));
View Full Code Here

    IndexSearcher search = newSearcher(reader);

    String minRP = pad(signedIndexDir.minR);
    String maxRP = pad(signedIndexDir.maxR);
   
    int numDocs = reader.numDocs();
       
    assertEquals("num of docs", numDocs, 1+ maxId - minId);
       
    ScoreDoc[] result;
    Query q = new TermQuery(new Term("body","body"));
View Full Code Here

  public void testFieldCacheRangeFilterShorts() throws IOException {

    IndexReader reader = signedIndexReader;
    IndexSearcher search = newSearcher(reader);

    int numDocs = reader.numDocs();
    int medId = ((maxId - minId) / 2);
    Short minIdO = Short.valueOf((short) minId);
    Short maxIdO = Short.valueOf((short) maxId);
    Short medIdO = Short.valueOf((short) medId);
       
View Full Code Here

  public void testFieldCacheRangeFilterInts() throws IOException {

    IndexReader reader = signedIndexReader;
    IndexSearcher search = newSearcher(reader);

    int numDocs = reader.numDocs();
    int medId = ((maxId - minId) / 2);
    Integer minIdO = Integer.valueOf(minId);
    Integer maxIdO = Integer.valueOf(maxId);
    Integer medIdO = Integer.valueOf(medId);
       
View Full Code Here

  public void testFieldCacheRangeFilterLongs() throws IOException {

    IndexReader reader = signedIndexReader;
    IndexSearcher search = newSearcher(reader);

    int numDocs = reader.numDocs();
    int medId = ((maxId - minId) / 2);
    Long minIdO = Long.valueOf(minId);
    Long maxIdO = Long.valueOf(maxId);
    Long medIdO = Long.valueOf(medId);
       
View Full Code Here

  public void testFieldCacheRangeFilterFloats() throws IOException {

    IndexReader reader = signedIndexReader;
    IndexSearcher search = newSearcher(reader);

    int numDocs = reader.numDocs();
    Float minIdO = Float.valueOf(minId + .5f);
    Float medIdO = Float.valueOf(minIdO.floatValue() + ((maxId-minId))/2.0f);
       
    ScoreDoc[] result;
    Query q = new TermQuery(new Term("body","body"));
View Full Code Here

  public void testFieldCacheRangeFilterDoubles() throws IOException {

    IndexReader reader = signedIndexReader;
    IndexSearcher search = newSearcher(reader);

    int numDocs = reader.numDocs();
    Double minIdO = Double.valueOf(minId + .5);
    Double medIdO = Double.valueOf(minIdO.floatValue() + ((maxId-minId))/2.0);
       
    ScoreDoc[] result;
    Query q = new TermQuery(new Term("body","body"));
View Full Code Here

   *
   * @throws Exception
   */
  public void testVerifyIndex() throws Exception {
    final IndexReader reader = IndexReader.open(mDirectory, true);
    assertEquals(8, reader.numDocs());
    reader.close();
  }
 
  /**
   * Tests a single span query that matches multiple documents.
View Full Code Here

    assertTrue("Index does not exist?...!", IndexReader.indexExists(benchmark.getRunData().getDirectory()));
    // now we should be able to open the index for write.
    IndexWriter iw = new IndexWriter(benchmark.getRunData().getDirectory(),null,false, IndexWriter.MaxFieldLength.LIMITED);
    iw.close();
    IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory());
    assertEquals("1000 docs were added to the index, this is what we expect to find!",1000,ir.numDocs());
    ir.close();
  }

  /**
   * Test timed sequence task.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.