Search in sources :

Example 31 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method mapIndexesHandle.

protected void mapIndexesHandle(Node n, MapConfig mapConfig) {
    for (Node indexNode : childElements(n)) {
        if (matches("index", cleanNodeName(indexNode))) {
            IndexConfig indexConfig = IndexUtils.getIndexConfigFromXml(indexNode, domLevel3, strict);
            mapConfig.addIndexConfig(indexConfig);
        }
    }
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) Node(org.w3c.dom.Node)

Example 32 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method queryCacheIndexesHandle.

protected void queryCacheIndexesHandle(Node n, QueryCacheConfig queryCacheConfig) {
    for (Node indexNode : childElements(n)) {
        if (matches("index", cleanNodeName(indexNode))) {
            IndexConfig indexConfig = IndexUtils.getIndexConfigFromXml(indexNode, domLevel3, strict);
            queryCacheConfig.addIndexConfig(indexConfig);
        }
    }
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) Node(org.w3c.dom.Node)

Example 33 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class QueryIndexMigrationTest method newConfigWithIndex.

private Config newConfigWithIndex(String mapName, String attribute) {
    Config config = getTestConfig();
    config.setProperty(ClusterProperty.WAIT_SECONDS_BEFORE_JOIN.getName(), "0");
    config.getMapConfig(mapName).addIndexConfig(new IndexConfig(IndexType.HASH, attribute));
    return config;
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig)

Example 34 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class QueryBasicTest method testQueryPortableObjectWithIndexAndAlwaysCacheValues.

@Test
public void testQueryPortableObjectWithIndexAndAlwaysCacheValues() {
    String name = randomMapName();
    Config config = getConfig();
    config.addMapConfig(new MapConfig(name).setCacheDeserializedValues(CacheDeserializedValues.ALWAYS).addIndexConfig(new IndexConfig(IndexType.SORTED, "timestamp")));
    testQueryUsingPortableObject(config, name);
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) MapConfig(com.hazelcast.config.MapConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 35 with IndexConfig

use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.

the class QueryBasicTest method testOptionalOrderedIndexQuerying.

@Test
public void testOptionalOrderedIndexQuerying() {
    String name = randomMapName();
    Config config = smallInstanceConfig();
    config.getMapConfig(name).addIndexConfig(new IndexConfig(IndexType.SORTED, "attribute"));
    HazelcastInstance instance = createHazelcastInstance(config);
    IMap<Integer, ObjectWithOptional<Integer>> map = instance.getMap(name);
    for (int i = 0; i < 10; ++i) {
        map.put(i, new ObjectWithOptional<>(i % 2 == 0 ? i : null));
    }
    Set<Integer> result = map.keySet(Predicates.equal("attribute", null));
    assertEqualSets(result, 1, 3, 5, 7, 9);
    assertEquals(1, map.getLocalMapStats().getIndexedQueryCount());
    result = map.keySet(Predicates.notEqual("attribute", null));
    assertEqualSets(result, 0, 2, 4, 6, 8);
    assertEquals(1, map.getLocalMapStats().getIndexedQueryCount());
    result = map.keySet(Predicates.greaterThan("attribute", 4));
    assertEqualSets(result, 6, 8);
    assertEquals(2, map.getLocalMapStats().getIndexedQueryCount());
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) ObjectWithOptional(com.hazelcast.query.SampleTestObjects.ObjectWithOptional) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

IndexConfig (com.hazelcast.config.IndexConfig)130 Test (org.junit.Test)49 QuickTest (com.hazelcast.test.annotation.QuickTest)45 Config (com.hazelcast.config.Config)42 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)38 MapConfig (com.hazelcast.config.MapConfig)34 HazelcastInstance (com.hazelcast.core.HazelcastInstance)29 ArrayList (java.util.ArrayList)16 Before (org.junit.Before)13 MapStoreConfig (com.hazelcast.config.MapStoreConfig)12 InternalIndex (com.hazelcast.query.impl.InternalIndex)12 AttributeConfig (com.hazelcast.config.AttributeConfig)9 MapContainer (com.hazelcast.map.impl.MapContainer)9 IndexRangeFilter (com.hazelcast.sql.impl.exec.scan.index.IndexRangeFilter)9 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)8 Node (org.w3c.dom.Node)8 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)7 IMap (com.hazelcast.map.IMap)7 Indexes (com.hazelcast.query.impl.Indexes)7 ExpressionEvalContext (com.hazelcast.sql.impl.expression.ExpressionEvalContext)7