Examples of deleteDocuments()


Examples of org.apache.lucene.index.RandomIndexWriter.deleteDocuments()

    for (int i = 0; i < numDeletes; i++) {
      Term toDelete = new Term("id", Integer.toString(random.nextInt(numDocs)));
      if (random.nextBoolean()) {
        iw.deleteDocuments(toDelete);
      } else {
        iw.deleteDocuments(new TermQuery(toDelete));
      }
    }
   
    reader = iw.getReader();
    s1 = newSearcher(reader);
View Full Code Here

Examples of org.apache.lucene.index.RandomIndexWriter.deleteDocuments()

    assertEquals("[just filter] Should find a hit...", 1, docs.totalHits);

    // now delete the doc, refresh the reader, and see that
    // it's not there
    _TestUtil.keepFullyDeletedSegments(writer.w);
    writer.deleteDocuments(new Term("id", "1"));

    reader = refreshReader(reader);
    searcher.close();
    searcher = newSearcher(reader, false);
View Full Code Here

Examples of org.apache.lucene.index.RandomIndexWriter.deleteDocuments()

    docs = searcher.search(constantScore, 1);
    assertEquals("[just filter] Should find a hit...", 1, docs.totalHits);
    assertEquals(missCount, filter.missCount);

    // now delete the doc, refresh the reader, and see that it's not there
    writer.deleteDocuments(new Term("id", "1"));

    reader = refreshReader(reader);
    searcher.close();
    searcher = newSearcher(reader, false);
View Full Code Here

Examples of org.apache.lucene.index.RandomIndexWriter.deleteDocuments()

    docs = searcher.search(constantScore, 1);
    assertEquals("[just filter] Should find a hit...", 1, docs.totalHits);

    // now delete the doc, refresh the reader, and see that it's not there
    _TestUtil.keepFullyDeletedSegments(writer.w);
    writer.deleteDocuments(new Term("id", "1"));

    reader = refreshReader(reader);
    searcher.close();
    searcher = newSearcher(reader, false);
View Full Code Here

Examples of org.apache.lucene.index.RandomIndexWriter.deleteDocuments()

    docs = searcher.search(constantScore, 1);
    assertEquals("[just filter] Should find a hit...", 1, docs.totalHits);
    assertEquals(missCount, filter.missCount);

    // now delete the doc, refresh the reader, and see that it's not there
    writer.deleteDocuments(new Term("id", "1"));

    reader = refreshReader(reader);
    searcher.close();
    searcher = newSearcher(reader, false);
View Full Code Here

Examples of org.apache.lucene.index.RandomIndexWriter.deleteDocuments()

    constantScore = new ConstantScoreQuery(filter);
    docs = searcher.search(constantScore, 1);
    assertEquals("[just filter] Should find a hit...", 1, docs.totalHits);

    // now delete the doc, refresh the reader, and see that it's not there
    writer.deleteDocuments(new Term("id", "1"));

    reader = refreshReader(reader);
    searcher.close();
    searcher = newSearcher(reader, false);
View Full Code Here

Examples of org.apache.lucene.index.TrackingIndexWriter.deleteDocuments()

      @Override
      public void run() {
        try {
          signal.await();
          manager.maybeRefresh();
          writer.deleteDocuments(new TermQuery(new Term("foo", "barista")));
          manager.maybeRefresh(); // kick off another reopen so we inc. the internal gen
        } catch (Exception e) {
          e.printStackTrace();
        } finally {
          latch.countDown(); // let the add below finish
View Full Code Here

Examples of org.apache.lucene.search.NRTManager.TrackingIndexWriter.deleteDocuments()

                  }
                }

                if (allIDs.size() > 0 && threadRandom.nextDouble() <= deleteChance) {
                  String randomID = allIDs.get(threadRandom.nextInt(allIDs.size()));
                  w.deleteDocuments(new Term("id", randomID));
                  rt.delete(randomID);
                  values.put(randomID, missing);
                }

                if (threadRandom.nextDouble() <= reopenChance || rt.size() > 10000) {
View Full Code Here

Examples of org.springmodules.lucene.index.core.DefaultLuceneIndexTemplate.deleteDocuments()

    definition.setIndexReaderOpen(true);
    definition.setWriteOperationsForIndexReaderAuthorized(true);
    try {
      resourceManager.initializeResources(definition);
     
      template.deleteDocuments(new Term("id", "1"));
      template.hasDeletions();
      template.isDeleted(1);
      template.isDeleted(2);
      template.undeleteDocuments();
    } finally {
View Full Code Here

Examples of org.springmodules.lucene.index.core.DefaultLuceneIndexTemplate.deleteDocuments()

      document.add(new Field("id", "3", Field.Store.YES, Field.Index.UN_TOKENIZED));
      template.addDocument(document);
      template.addDocument(document);
      template.addDocument(document);
      try {
        template.deleteDocuments(new Term("id", "1"));
        fail();
      } catch(LuceneIndexingException ex) {}
      template.optimize();
    } finally {
      resourceManager.releaseResources();
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.