}
public void testReindexing() throws Exception {
Cache cache = cache(0).getAdvancedCache().withFlags(Flag.SKIP_INDEXING);
SearchManager searchManager = Search.getSearchManager(cache);
Query query = searchManager.buildQueryBuilderForClass(Car.class)
.get()
.keyword()
.onField("make")
.matching("ford")
.createQuery();
cache.put("car1", new Car("ford", "white", 300));
cache.put("car2", new Car("ford", "blue", 300));
cache.put("car3", new Car("ford", "red", 300));
// ensure these were not indexed
assertEquals(0, searchManager.getQuery(query, Car.class).getResultSize());
//reindex
searchManager.getMassIndexer().start();
// check that the indexing is complete immediately
assertEquals(3, searchManager.getQuery(query, Car.class).getResultSize());
}