use of com.hazelcast.query.impl.Index in project hazelcast by hazelcast.
the class AddIndexOperation method run.
@Override
public void run() throws Exception {
Indexes indexes = mapContainer.getIndexes();
Index index = indexes.addOrGetIndex(attributeName, ordered);
final long now = getNow();
final Iterator<Record> iterator = recordStore.iterator(now, false);
SerializationService serializationService = getNodeEngine().getSerializationService();
while (iterator.hasNext()) {
final Record record = iterator.next();
Data key = record.getKey();
Object value = Records.getValueOrCachedValue(record, serializationService);
QueryableEntry queryEntry = mapContainer.newQueryEntry(key, value);
index.saveEntryIndex(queryEntry, null);
}
}
use of com.hazelcast.query.impl.Index in project hazelcast by hazelcast.
the class PredicatesTest method testNotEqualsPredicateDoesNotUseIndex.
@Test
public void testNotEqualsPredicateDoesNotUseIndex() {
Index dummyIndex = new IndexImpl("foo", false, ss, Extractors.empty());
QueryContext mockQueryContext = mock(QueryContext.class);
when(mockQueryContext.getIndex(anyString())).thenReturn(dummyIndex);
NotEqualPredicate p = new NotEqualPredicate("foo", "bar");
boolean indexed = p.isIndexed(mockQueryContext);
assertFalse(indexed);
}
Aggregations