use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class ShardingMassIndexTest method testReindex.
@Test(enabled = false, description = "Shards going to different index managers are not currently supported")
public void testReindex() throws Exception {
Cache<Integer, Object> cache = cache(0);
cache.put(1, new Car("mazda", "red", 200));
cache.put(2, new Car("mazda", "blue", 200));
cache.put(3, new Car("audi", "blue", 170));
cache.put(4, new Car("audi", "black", 170));
checkIndex(4, Car.class);
runMassIndexer();
checkIndex(4, Car.class);
cache.clear();
runMassIndexer();
checkIndex(0, Car.class);
}
use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class MassIndexingTest method testReindexing.
public void testReindexing() {
for (int i = 0; i < 10; i++) {
cache(i % 2).getAdvancedCache().withFlags(Flag.SKIP_INDEXING).put(key("F" + i + "NUM"), new Car((i % 2 == 0 ? "megane" : "bmw"), "blue", 300 + i));
}
// Adding also non-indexed values
cache(0).getAdvancedCache().put(key("FNonIndexed1NUM"), new NotIndexedType("test1"));
cache(0).getAdvancedCache().put(key("FNonIndexed2NUM"), new NotIndexedType("test2"));
verifyFindsCar(0, "megane");
verifyFindsCar(0, "test1");
verifyFindsCar(0, "test2");
cache(0).getAdvancedCache().withFlags(Flag.SKIP_INDEXING).put(key("FNonIndexed3NUM"), new NotIndexedType("test3"));
verifyFindsCar(0, "test3");
// re-sync datacontainer with indexes:
rebuildIndexes();
verifyFindsCar(5, "megane");
verifyFindsCar(0, "test1");
verifyFindsCar(0, "test2");
}
use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class MassIndexingWithStoreTest method testReindexing.
@Override
public void testReindexing() throws Exception {
Cache<String, Car> cache0 = cache(0);
for (int i = 0; i < 10; i++) {
cache0.put("CAR#" + i, new Car("Volkswagen", "white", 200));
}
rebuildIndexes();
verifyFindsCar(10, "Volkswagen");
}
use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class PerfTest method testIndexing.
public void testIndexing() throws Exception {
int carId = 0;
int cacheId = 0;
final long start = System.nanoTime();
for (int outherLoop = 0; outherLoop < NUMBER_OF_ITERATIONS; outherLoop++) {
final Cache<String, Car> cache = getWriteOnlyCache(cacheId++ % NUM_NODES);
System.out.print("Using " + cacheId + ": " + cache + "\t");
final long blockStart = System.nanoTime();
cache.startBatch();
for (int innerLoop = 0; innerLoop < LOG_ON_EACH; innerLoop++) {
carId++;
cache.put("car" + carId, new Car("megane", "blue", 300 + carId));
carId++;
cache.put("car" + carId, new Car("bmw", "blue", 300 + carId));
}
cache.endBatch(true);
System.out.println("Inserted " + LOG_ON_EACH + " cars in " + Util.prettyPrintTime(System.nanoTime() - blockStart, TimeUnit.NANOSECONDS));
}
System.out.println("Test took " + Util.prettyPrintTime(System.nanoTime() - start, TimeUnit.NANOSECONDS));
verifyFindsCar(carId / 2, "megane");
}
use of org.infinispan.query.queries.faceting.Car in project infinispan by infinispan.
the class DegeneratedClusterMassIndexingTest method testReindexing.
public void testReindexing() {
Cache<String, Car> cache = this.<String, Car>cache(0).getAdvancedCache().withFlags(Flag.SKIP_INDEXING);
cache.put("car1", new Car("ford", "white", 300));
cache.put("car2", new Car("ford", "blue", 300));
cache.put("car3", new Car("ford", "red", 300));
QueryFactory queryFactory = Search.getQueryFactory(cache);
// ensure these were not indexed
String q = String.format("FROM %s where make:'ford'", Car.class.getName());
Query<Car> query = queryFactory.create(q);
assertEquals(0, query.execute().hitCount().orElse(-1));
// reindex
join(Search.getIndexer(cache).run());
// check that the indexing is complete immediately
assertEquals(3, query.execute().hitCount().orElse(-1));
}
Aggregations