try
{
idxSystem.setBatchSize(10);
long version = 0;
DefaultZoieVersion zvt = null;
final int count = TestData.testdata.length;
List<DataEvent<String,DefaultZoieVersion>> list = new ArrayList<DataEvent<String,DefaultZoieVersion>>(count);
for (int i = 0; i < count; i++)
{
//version = i;
zvt = new DefaultZoieVersion();
zvt.setVersionId(i);
//list.add(new DataEvent<String>(i, TestData.testdata[i]));
list.add(new DataEvent<String,DefaultZoieVersion>(TestData.testdata[i],zvt));
}
memoryProvider.addEvents(list);
idxSystem.syncWthVersion(10000, zvt);
QueryParser parser = new QueryParser(Version.LUCENE_CURRENT,"contents",idxSystem.getAnalyzer());
Query q;
Searcher searcher = null;
List<ZoieIndexReader<IndexReader>> readers = null;
TopDocs hits;
q = parser.parse("zoie");
readers=idxSystem.getIndexReaders();
for(int i=0; i<readers.size(); i++)
{
IndexReader ir = readers.get(i);
Map<String, String> commitData = IndexReader.getCommitUserData(ir.directory()); // = new HashMap<String,String>();
System.out.println("i:" + i + "ZoieTest: directory: " + ir.directory());
System.out.println("i:" + i + "ZoieTest: commitData(ZoieVersion): " + commitData);
}
if(2>1) return;
MultiReader reader=new MultiReader(readers.toArray(new IndexReader[readers.size()]),false);
searcher=new IndexSearcher(reader);
hits = searcher.search(q,10);
int expected = TestData.testdata.length;
assertEquals("before update: zoie count mismatch[hit count: " + hits.totalHits +" / expected: "+TestData.testdata.length +"]", count, hits.totalHits);
q = parser.parse("zoie2");
searcher.close();
reader.close();
idxSystem.returnIndexReaders(readers);
readers=idxSystem.getIndexReaders();
reader=new MultiReader(readers.toArray(new IndexReader[readers.size()]),false);
searcher=new IndexSearcher(reader);
hits = searcher.search(q,10);
assertEquals("before update: zoie2 count mismatch[hit count: " + hits.totalHits +" / expected: "+ 0 +"]", 0, hits.totalHits);
searcher.close();
reader.close();
idxSystem.returnIndexReaders(readers);
list = new ArrayList<DataEvent<String,DefaultZoieVersion>>(TestData.testdata2.length);
for(int i = 0; i < TestData.testdata2.length; i++)
{
version = count + i;
zvt = new DefaultZoieVersion();
zvt.setVersionId(version);
list.add(new DataEvent<String,DefaultZoieVersion>(TestData.testdata2[i],zvt));
}
memoryProvider.addEvents(list);
idxSystem.syncWthVersion(10000, zvt);