Search in sources :

Example 1 with SortedSetQuery

use of org.apache.geode.redis.internal.executor.SortedSetQuery in project geode by apache.

the class RegionProvider method doInitializeSortedSet.

private void doInitializeSortedSet(ByteArrayWrapper key, Region<?, ?> r) throws RegionNotFoundException, IndexInvalidException {
    String fullpath = r.getFullPath();
    try {
        queryService.createIndex("scoreIndex", "entry.value.score", r.getFullPath() + ".entrySet entry");
        queryService.createIndex("scoreIndex2", "value.score", r.getFullPath() + ".values value");
    } catch (IndexNameConflictException | IndexExistsException | UnsupportedOperationException e) {
    // ignore, these indexes already exist or unsupported but make sure prepared queries are made
    }
    HashMap<Enum<?>, Query> queryList = new HashMap<Enum<?>, Query>();
    for (SortedSetQuery lq : SortedSetQuery.values()) {
        String queryString = lq.getQueryString(fullpath);
        Query query = this.queryService.newQuery(queryString);
        queryList.put(lq, query);
    }
    this.preparedQueries.put(key, queryList);
}
Also used : IndexExistsException(org.apache.geode.cache.query.IndexExistsException) Query(org.apache.geode.cache.query.Query) SortedSetQuery(org.apache.geode.redis.internal.executor.SortedSetQuery) ListQuery(org.apache.geode.redis.internal.executor.ListQuery) IndexNameConflictException(org.apache.geode.cache.query.IndexNameConflictException) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) SortedSetQuery(org.apache.geode.redis.internal.executor.SortedSetQuery)

Aggregations

HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 IndexExistsException (org.apache.geode.cache.query.IndexExistsException)1 IndexNameConflictException (org.apache.geode.cache.query.IndexNameConflictException)1 Query (org.apache.geode.cache.query.Query)1 ListQuery (org.apache.geode.redis.internal.executor.ListQuery)1 SortedSetQuery (org.apache.geode.redis.internal.executor.SortedSetQuery)1