Examples of maxDoc()


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

    IndexSearcher searcher = newSearcher(reader);
   
    int numQueries = atLeast(10);
    for (int i = 0; i < numQueries; i++) {
      Term term = terms.get(random().nextInt(num));
      TopDocs queryResult = searcher.search(new TermQuery(term), reader.maxDoc());
     
      MatchAllDocsQuery matchAll = new MatchAllDocsQuery();
      final TermFilter filter = termFilter(term);
      TopDocs filterResult = searcher.search(matchAll, filter, reader.maxDoc());
      assertEquals(filterResult.totalHits, queryResult.totalHits);
View Full Code Here

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

      Term term = terms.get(random().nextInt(num));
      TopDocs queryResult = searcher.search(new TermQuery(term), reader.maxDoc());
     
      MatchAllDocsQuery matchAll = new MatchAllDocsQuery();
      final TermFilter filter = termFilter(term);
      TopDocs filterResult = searcher.search(matchAll, filter, reader.maxDoc());
      assertEquals(filterResult.totalHits, queryResult.totalHits);
      ScoreDoc[] scoreDocs = filterResult.scoreDocs;
      for (int j = 0; j < scoreDocs.length; j++) {
        assertEquals(scoreDocs[j].doc, queryResult.scoreDocs[j].doc);
      }
View Full Code Here

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

    synchronized ReadOnlyIndexReader getReadOnlyIndexReader()
            throws IOException {
        // get current modifiable index reader
        IndexReader modifiableReader = getIndexReader();
        // capture snapshot of deleted documents
        BitSet deleted = new BitSet(modifiableReader.maxDoc());
        for (int i = 0; i < modifiableReader.maxDoc(); i++) {
            if (modifiableReader.isDeleted(i)) {
                deleted.set(i);
            }
        }
View Full Code Here

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

            throws IOException {
        // get current modifiable index reader
        IndexReader modifiableReader = getIndexReader();
        // capture snapshot of deleted documents
        BitSet deleted = new BitSet(modifiableReader.maxDoc());
        for (int i = 0; i < modifiableReader.maxDoc(); i++) {
            if (modifiableReader.isDeleted(i)) {
                deleted.set(i);
            }
        }
        if (sharedReader == null) {
View Full Code Here

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

   * @throws IOException
   */
  public static void dumpDocumentFields(File indexDir, String field, long maxDocs, PrintWriter out) throws IOException {
    Directory dir = FSDirectory.open(indexDir);
    IndexReader reader = IndexReader.open(dir, true);
    int max = reader.maxDoc();
    for (int i=0; i < max; i++) {
      if (!reader.isDeleted(i)) {
        Document d = reader.document(i);
        for (Field f: d.getFields(field)) {
          if (f.isStored() && !f.isBinary()) {
View Full Code Here

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

    OpenObjectIntHashMap<String> categoryCounts = new OpenObjectIntHashMap<String>();
    Map<String, List<String>> categories = readCategoryFile(categoryFile);
   
    Directory dir = FSDirectory.open(indexDir);
    IndexReader reader = IndexReader.open(dir, true);
    int max = reader.maxDoc();
   
    StringBuilder buf = new StringBuilder();
   
    for (int i=0; i < max; i++) {
      if (!reader.isDeleted(i)) {
View Full Code Here

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

  }
 
  public static void dumpDocs(File indexDir, PrintWriter out, long maxDocs) throws IOException {
    Directory dir = FSDirectory.open(indexDir);
    IndexReader reader = IndexReader.open(dir, true);
    int max = reader.maxDoc();
   
    StringBuilder buf = new StringBuilder();
   
    for (int i=0; i < max; i++) {
      if (!reader.isDeleted(i)) {
View Full Code Here

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

  //-------------------------------------------------------------------------

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

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

        // test norms as used by multireader

        aprioriNorms = new byte[aprioriReader.maxDoc()];
        aprioriReader.norms((String) field, aprioriNorms, 0);

        testNorms = new byte[testReader.maxDoc()];
        testReader.norms((String) field, testNorms, 0);

        assertEquals(aprioriNorms.length, testNorms.length);

        for (int i = 0; i < aprioriNorms.length; i++) {
View Full Code Here

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

        // test norms as used by multireader

        aprioriNorms = new byte[aprioriReader.maxDoc() + 10];
        aprioriReader.norms((String) field, aprioriNorms, 10);

        testNorms = new byte[testReader.maxDoc() + 10];
        testReader.norms((String) field, testNorms, 10);

        assertEquals(aprioriNorms.length, testNorms.length);
       
        for (int i = 0; i < aprioriNorms.length; i++) {
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.