use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class DistributedMassIndexingTest method testReindexing.
public void testReindexing() throws Exception {
cache(0).put(key("F1NUM"), new Car("megane", "white", 300));
verifyFindsCar(1, "megane");
cache(1).put(key("F2NUM"), new Car("megane", "blue", 300));
verifyFindsCar(2, "megane");
// add an entry without indexing it:
cache(1).getAdvancedCache().withFlags(Flag.SKIP_INDEXING).put(key("F3NUM"), new Car("megane", "blue", 300));
verifyFindsCar(2, "megane");
// re-sync datacontainer with indexes:
rebuildIndexes();
verifyFindsCar(3, "megane");
// verify we cleanup old stale index values by deleting an entry without deleting the corresponding index value
cache(2).getAdvancedCache().withFlags(Flag.SKIP_INDEXING).remove(key("F2NUM"));
assertIndexedEntities(3, Car.class, cache(2));
// re-sync
rebuildIndexes();
assertIndexedEntities(2, Car.class, cache(2));
verifyFindsCar(2, "megane");
}
use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class ManualIndexingTest method assertNumberOfCars.
private void assertNumberOfCars(int expectedCount, String carMake) {
for (Cache<?, ?> cache : caches) {
QueryFactory queryFactory = Search.getQueryFactory(cache);
Query<Car> query = queryFactory.create(String.format("FROM %s where make:'%s'", Car.class.getName(), carMake));
QueryResult<Car> queryResult = query.execute();
assertEquals("Expected count not met on cache " + cache, expectedCount, queryResult.hitCount().orElse(-1));
assertEquals("Expected count not met on cache " + cache, expectedCount, queryResult.list().size());
}
}
use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class ManualIndexingTest method createCacheManagers.
@Override
protected void createCacheManagers() throws Throwable {
for (int i = 0; i < NUM_NODES; i++) {
EmbeddedCacheManager cacheManager = TestCacheManagerFactory.fromXml("manual-indexing-distribution.xml");
registerCacheManager(cacheManager);
Cache<String, Car> cache = cacheManager.getCache();
caches.add(cache);
}
waitForClusterToForm("default");
}
use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class ManualIndexingTest method testManualIndexing.
public void testManualIndexing() {
caches.get(0).put("car A", new Car("ford", "blue", 400));
caches.get(0).put("car B", new Car("megane", "white", 300));
caches.get(0).put("car C", new Car("megane", "red", 500));
assertNumberOfCars(0, "megane");
assertNumberOfCars(0, "ford");
// rebuild index
join(Search.getIndexer(caches.get(0)).run());
assertNumberOfCars(2, "megane");
assertNumberOfCars(1, "ford");
}
use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class ReplRamMassIndexingTest method testReindexing.
@Override
public void testReindexing() throws Exception {
final int NUM_CARS = 100;
for (int i = 0; i < NUM_CARS; ++i) {
cache(i % NUM_NODES).put("car" + i, new Car("skoda", "white", 42));
}
for (Cache cache : caches()) {
assertEquals(cache.size(), NUM_CARS);
verifyFindsCar(cache, NUM_CARS, "skoda");
}
rebuildIndexes();
for (int i = 0; i < NUM_CARS; ++i) {
String key = "car" + i;
for (Cache cache : caches()) {
assertNotNull(cache.get(key));
}
}
verifyFindsCar(NUM_CARS, "skoda");
}
Aggregations