NOTE: this should be avoided in tests unless absolutely necessary, as it will result in less test coverage. @see IndexWriter#forceMerge(int)
207208209210211212213214215216217
} Document doc = new Document(); doc.add(new TextField("field", contents, Field.Store.NO)); w.addDocument(doc); } w.forceMerge(1); final IndexReader r = w.getReader(); final IndexSearcher s = newSearcher(r); w.close(); for(int iter=0;iter<10*RANDOM_MULTIPLIER;iter++) {
144145146147148149150151152153154
iw1.w.updateNumericDocValue(new Term("s", term), "ndv", value); iw2.w.updateNumericDocValue(new Term("s", term), "ndv", value); } iw1.forceMerge(1); iw2.forceMerge(1); iw1.close(); iw2.close(); reader = DirectoryReader.open(dir1); sortedReader = DirectoryReader.open(dir2); }
530531532533534535536537538539540
w.commit(); doc = new Document(); doc.add(makeIDField("id", 17)); // Replaces the doc we just indexed: w.updateDocument(new Term("id", "id"), doc); w.forceMerge(1); w.close(); dir.close(); } // LUCENE-5693: because CheckIndex cross-checks term vectors with postings even for deleted docs, and because our PF only indexes the
833834835836837838839840841842843
if (i == 1) { break; } // forceMerge and verify again w.forceMerge(1); } mgr.close(); w.close(); dir.close();
196197198199200201202203204205206
for (int f = 0; f < NUMBER_OF_FIELDS; f++) { document.add(newStringField("field" + f, getText(), Field.Store.NO)); } writer.addDocument(document); } writer.forceMerge(1); writer.close(); } private static String getText() { return Long.toString(random().nextLong(),Character.MAX_RADIX);
604605606607608609610611612613614
if (random().nextBoolean()) { if (VERBOSE) { System.out.println("TEST: forceMerge(1)..."); } w.forceMerge(1); } IndexReader r = w.getReader(); w.close(); final SortedSetDocValuesReaderState sortedSetDVState;
125126127128129130131132133134135
final Document doc = randomDocument(); iw1.addDocument(doc); iw2.addDocument(doc); iw1.forceMerge(1); iw2.forceMerge(1); iw1.close(); iw2.close(); reader = DirectoryReader.open(dir1); sortedReader = DirectoryReader.open(dir2); }
7980818283848586878889
if (random().nextInt(100) < 10) { addSome(doc, rareTerms); } iw.addDocument(doc); } iw.forceMerge(1); iw.close(); r = DirectoryReader.open(dir); reader = getOnlySegmentReader(r); searcher = new IndexSearcher(reader); searcher.setSimilarity(new DefaultSimilarity() {
4445464748495051525354
d = newDirectory(); RandomIndexWriter w = new RandomIndexWriter(random(), d); Document doc = new Document(); doc.add(newField("ints", "1", StringField.TYPE_NOT_STORED)); w.addDocument(doc); w.forceMerge(1); r = w.getReader(); w.close(); subR = r.leaves().get(0).reader(); }
737738739740741742743744745746747
} else { field.setLongValue(v); iw.addDocument(doc); } } iw.forceMerge(1); final DirectoryReader reader = iw.getReader(); final FieldCache.Longs longs = FieldCache.DEFAULT.getLongs(getOnlySegmentReader(reader), "f", false); for (int i = 0; i < values.length; ++i) { assertEquals(values[i], longs.get(i)); }