NOTE: this should be avoided in tests unless absolutely necessary, as it will result in less test coverage. @see IndexWriter#forceMerge(int)
113114115116117118119120121122123
} if (!doMultiSegment) { if (VERBOSE) { System.out.println("TEST: setUp full merge"); } iw.forceMerge(1); } iw.close(); if (VERBOSE) { System.out.println("TEST: setUp done close"); }
138139140141142143144145146147148
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); }
8283848586878889909192
writer.addDocument (doc); // tests here require single segment (eg try seed // 8239472272678419952L), because SingleDocTestFilter(x) // blindly accepts that docID in any sub-segment writer.forceMerge(1); reader = writer.getReader(); writer.close (); searcher = newSearcher(reader);
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(); }
590591592593594595596597598599600
if (random().nextBoolean()) { if (VERBOSE) { System.out.println("TEST: forceMerge(1)..."); } w.forceMerge(1); } IndexReader r = w.getReader(); w.close(); final SortedSetDocValuesReaderState sortedSetDVState;
151152153154155156157158159160161
} doc.add(newStringField("field" + i, "content1", Field.Store.YES)); w.addDocument(doc); } w.forceMerge(1); IndexReader reader = w.getReader(); w.close(); assertEquals(1, reader.leaves().size());
190191192193194195196197198199200
terms.add(t); break; } } } w.forceMerge(1); IndexReader reader = w.getReader(); w.close(); assertEquals(1, reader.leaves().size()); AtomicReaderContext context = reader.leaves().get(0); TermsFilter tf = new TermsFilter(new ArrayList<Term>(terms));
549550551552553554555556557558559
if (random().nextBoolean()) { if (VERBOSE) { System.out.println("TEST: forceMerge(1)..."); } w.forceMerge(1); } IndexReader r = w.getReader(); final SortedSetDocValuesReaderState sortedSetDVState; IndexSearcher s = newSearcher(r);
863864865866867868869870871872873
writer.addDocument(doc); writer.addDocument(doc); writer.addDocument(doc); // Test wants 3 docs in one segment: writer.forceMerge(1); final ValueSource vs = new ValueSource() { @SuppressWarnings("rawtypes") @Override public FunctionValues getValues(Map ignored, AtomicReaderContext ignored2) {