use of com.orientechnologies.lucene.OLuceneTxOperations in project orientdb by orientechnologies.
the class OLuceneIndexNotUnique method removeFromSnapshot.
@Override
protected void removeFromSnapshot(Object key, OIdentifiable value, Map<Object, Object> snapshot) {
key = getCollatingValue(key);
OLuceneTxOperations operations = (OLuceneTxOperations) snapshot.get(key);
if (operations == null) {
operations = new OLuceneTxOperations();
snapshot.put(key, operations);
}
operations.removed.add(value.getIdentity());
snapshot.put(key, operations);
}
use of com.orientechnologies.lucene.OLuceneTxOperations in project orientdb by orientechnologies.
the class OLuceneIndexNotUnique method commitSnapshot.
@Override
protected void commitSnapshot(final Map<Object, Object> snapshot) {
while (true) try {
storage.callIndexEngine(false, false, indexId, new OIndexEngineCallback<Object>() {
@Override
public Boolean callEngine(OIndexEngine engine) {
OLuceneIndexEngine indexEngine = (OLuceneIndexEngine) engine;
for (Map.Entry<Object, Object> snapshotEntry : snapshot.entrySet()) {
Object key = snapshotEntry.getKey();
OLuceneTxOperations operations = (OLuceneTxOperations) snapshotEntry.getValue();
for (OIdentifiable oIdentifiable : operations.removed) {
indexEngine.remove(decodeKey(key), oIdentifiable);
}
}
for (Map.Entry<Object, Object> snapshotEntry : snapshot.entrySet()) {
Object key = snapshotEntry.getKey();
OLuceneTxOperations operations = (OLuceneTxOperations) snapshotEntry.getValue();
indexEngine.put(decodeKey(key), operations.added);
}
OTransaction transaction = getDatabase().getTransaction();
resetTransactionChanges(transaction);
return null;
}
});
break;
} catch (OInvalidIndexEngineIdException e) {
doReloadIndexEngine();
}
}
use of com.orientechnologies.lucene.OLuceneTxOperations in project orientdb by orientechnologies.
the class OLuceneIndexNotUnique method putInSnapshot.
@Override
protected void putInSnapshot(Object key, OIdentifiable value, Map<Object, Object> snapshot) {
key = getCollatingValue(key);
OLuceneTxOperations operations = (OLuceneTxOperations) snapshot.get(key);
if (operations == null) {
operations = new OLuceneTxOperations();
snapshot.put(key, operations);
}
operations.added.add(value.getIdentity());
snapshot.put(key, operations);
}
Aggregations