Package org.apache.lucene.index

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


    for (int i = 0; i < reader.maxDoc(); i++) {
      if (reader.isDeleted(i)) {
        System.out.println("-doc " + i + " deleted");
        continue;
      }
      Document doc = reader.document(i);
      // make sure we got the right one
      assertEquals("check hash", hash.toString(), doc.get("digest"));
      System.out.println(doc);
    }
    reader.close();
View Full Code Here


    // assert with norms scoring turned off

    hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
    assertEquals(3, hits.length);
    assertEquals("one", ir.document(hits[0].doc).get("key"));
    assertEquals("two", ir.document(hits[1].doc).get("key"));
    assertEquals("three four", ir.document(hits[2].doc).get("key"));

    // assert with norms scoring turned on
View Full Code Here

    // assert with norms scoring turned off

    hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
    assertEquals(3, hits.length);
    assertEquals("one", ir.document(hits[0].doc).get("key"));
    assertEquals("two", ir.document(hits[1].doc).get("key"));
    assertEquals("three four", ir.document(hits[2].doc).get("key"));

    // assert with norms scoring turned on

    MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
View Full Code Here

    hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
    assertEquals(3, hits.length);
    assertEquals("one", ir.document(hits[0].doc).get("key"));
    assertEquals("two", ir.document(hits[1].doc).get("key"));
    assertEquals("three four", ir.document(hits[2].doc).get("key"));

    // assert with norms scoring turned on

    MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
    hits = is.search(normsQuery, null, 1000).scoreDocs;
View Full Code Here

    MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
    hits = is.search(normsQuery, null, 1000).scoreDocs;
    assertEquals(3, hits.length);

    assertEquals("three four", ir.document(hits[0].doc).get("key"));   
    assertEquals("two", ir.document(hits[1].doc).get("key"));
    assertEquals("one", ir.document(hits[2].doc).get("key"));

    // change norm & retest
    ir.setNorm(0, "key", 400f);
View Full Code Here

    MatchAllDocsQuery normsQuery = new MatchAllDocsQuery("key");
    hits = is.search(normsQuery, null, 1000).scoreDocs;
    assertEquals(3, hits.length);

    assertEquals("three four", ir.document(hits[0].doc).get("key"));   
    assertEquals("two", ir.document(hits[1].doc).get("key"));
    assertEquals("one", ir.document(hits[2].doc).get("key"));

    // change norm & retest
    ir.setNorm(0, "key", 400f);
    normsQuery = new MatchAllDocsQuery("key");
View Full Code Here

    hits = is.search(normsQuery, null, 1000).scoreDocs;
    assertEquals(3, hits.length);

    assertEquals("three four", ir.document(hits[0].doc).get("key"));   
    assertEquals("two", ir.document(hits[1].doc).get("key"));
    assertEquals("one", ir.document(hits[2].doc).get("key"));

    // change norm & retest
    ir.setNorm(0, "key", 400f);
    normsQuery = new MatchAllDocsQuery("key");
    hits = is.search(normsQuery, null, 1000).scoreDocs;
View Full Code Here

    ir.setNorm(0, "key", 400f);
    normsQuery = new MatchAllDocsQuery("key");
    hits = is.search(normsQuery, null, 1000).scoreDocs;
    assertEquals(3, hits.length);

    assertEquals("one", ir.document(hits[0].doc).get("key"));
    assertEquals("three four", ir.document(hits[1].doc).get("key"));   
    assertEquals("two", ir.document(hits[2].doc).get("key"));
   
    // some artificial queries to trigger the use of skipTo():
   
View Full Code Here

    normsQuery = new MatchAllDocsQuery("key");
    hits = is.search(normsQuery, null, 1000).scoreDocs;
    assertEquals(3, hits.length);

    assertEquals("one", ir.document(hits[0].doc).get("key"));
    assertEquals("three four", ir.document(hits[1].doc).get("key"));   
    assertEquals("two", ir.document(hits[2].doc).get("key"));
   
    // some artificial queries to trigger the use of skipTo():
   
    BooleanQuery bq = new BooleanQuery();
View Full Code Here

    hits = is.search(normsQuery, null, 1000).scoreDocs;
    assertEquals(3, hits.length);

    assertEquals("one", ir.document(hits[0].doc).get("key"));
    assertEquals("three four", ir.document(hits[1].doc).get("key"));   
    assertEquals("two", ir.document(hits[2].doc).get("key"));
   
    // some artificial queries to trigger the use of skipTo():
   
    BooleanQuery bq = new BooleanQuery();
    bq.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST);
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.