Hi,

we were looking to use  the IndexQuery instead of ScanQuery with filter, to 
speed up our queries.
But unfortunately it seems that IndexQuery are not a replacement for ScanQuery 
with filter (if index exist on filter criteria!),
as IndexQuery does not support transformers.

Exception in thread "main" java.lang.UnsupportedOperationException: 
Transformers are supported only for SCAN queries.
        at 
org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:871)

Any ideas how we can make use of indices but  still be able to use transformers 
or is  it  planned for further releases, this would be awesome.
Here is an example what we want to use:

```java
var personEntity = new QueryEntity(Integer.class, Person.class)
    .addQueryField("orgId", Integer.class.getName(), null)
    .addQueryField("salary", Integer.class.getName(), null)
    .setIndexes(List.of(
        new QueryIndex("salary", QueryIndexType.SORTED)));

var ccfg = new CacheConfiguration<Integer, Person>("entityCache")
    .setQueryEntities(List.of(personEntity));

var cache = ignite.getOrCreateCache(ccfg);

// Get only keys for persons earning more than 1,000.
List<Integer> keys;

// scan query
keys = cache.query(new ScanQuery<>(
    (k, p) -> p.getSalary() > 1000),
    (IgniteClosure<Cache.Entry<Integer, Person>, Integer>) 
Cache.Entry::getKey).getAll();

// index query
keys = cache.query(new IndexQuery<Integer, Person>(Person.class)
    .setCriteria(gt("salery", 1000)),
    (IgniteClosure<Cache.Entry<Integer, Person>, Integer>) 
Cache.Entry::getKey).getAll();
```

And another question: does IndexQuery support local queries (.setLocal(true))?

Thank you and looking forward to  hear your opinions.

Best,
Rafael



--
Rafael Troilo
HeiGIT gGmbH
Heidelberg Institute for Geoinformation Technology at Heidelberg University

https://heigit.org | rafael.tro...@heigit.org | phone +49-6221-533 484

Postal address: Schloss-Wolfsbrunnenweg 33 | 69118 Heidelberg | Germany
Offices: Berliner Str. 45 | 69120 Heidelberg | Germany

Amtsgericht Mannheim | HRB 733765
Managing Directors: Prof. Dr. Alexander Zipf | Dr. Gesa Schönberger

Reply via email to