Examples of docCount()


Examples of org.apache.lucene.index.IndexWriter.docCount()

        writer.addDocument(doc);
        writer.optimize();
    }finally {
        writer.close();
    }
    System.out.println("doc count = " + writer.docCount());
        return 1;
    }
    /* (non-Javadoc)
     * @see jdlog.search.SearchProxy#getWriter()
     */
 
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

        logger.debug("Add item " + item + " to index.");
      }
      writer.addDocument(ItemDocument.makeDocument(item));
    }
    writer.optimize();
    nrOfIndexedItems = writer.docCount();
    writer.close();
    logger.info("Finished writing index.");
  }

  /**
 
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

    for (int i = 0; i < docsToAdd; i++) {
      doc = new Document();
      doc.add(new Field("content", English.intToEnglish(i).trim(), Field.Store.YES, Field.Index.NOT_ANALYZED));
      writer.addDocument(doc);
    }
    assertEquals(docsToAdd, writer.docCount());
    writer.close();
  }
 
  public void testRAMDirectory () throws IOException {
   
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

        }
      }
    }

    // finish index
    int numIndexed = writer.docCount();
    writer.optimize();
    writer.close();
   
    return numIndexed;
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

            }
            catch (IOException e)
            {
               logger.error("Error adding document to index.", e);
            }
            logger.debug("Index Document Count = " + indexWriter.docCount());
            logger.info("Added '" + parsedObject.getTitle() + "' to index");
            result = true;
        }

        try
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

                    }
                } */

                // Add the document to search index
                indexWriter.addDocument(doc);
                logger.debug("Index Document Count = " + indexWriter.docCount());
                logger.info("Added '" + parsedObject.getTitle() + "' to index");
                result = true;
            }

            indexWriter.optimize();
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

        // add 100 documents
        for (i = 0; i < 100; i++) {
            addDoc(writer);
        }
        assertEquals(100, writer.docCount());
        writer.close();

        // delete 40 documents
        reader = IndexReader.open(dir);
        for (i = 0; i < 40; i++) {
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

        }
        reader.close();

        // test doc count before segments are merged/index is optimized
        writer = new IndexWriter(dir, new WhitespaceAnalyzer());
        assertEquals(100, writer.docCount());
        writer.close();

        reader = IndexReader.open(dir);
        assertEquals(100, reader.maxDoc());
        assertEquals(60, reader.numDocs());
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

        reader.close();

        // optimize the index and check that the new doc count is correct
        writer = new IndexWriter(dir, new WhitespaceAnalyzer());
        writer.optimize();
        assertEquals(60, writer.docCount());
        writer.close();

        // check that the index reader gives the same numbers.
        reader = IndexReader.open(dir);
        assertEquals(60, reader.maxDoc());
View Full Code Here

Examples of org.apache.lucene.index.IndexWriter.docCount()

        reader.close();

        // make sure opening a new index for create over
        // this existing one works correctly:
        writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
        assertEquals(0, writer.docCount());
        writer.close();
    }

    private void addDoc(IndexWriter writer) throws IOException
    {
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.