@Override public void unindex(String indexName, org.mwg.Node nodeToIndex, String flatKeyAttributes, Callback<Boolean> callback) { final String[] keyAttributes = flatKeyAttributes.split(Constants.QUERY_SEP + ""); final NodeState currentNodeState = this._resolver.alignState(this); if (currentNodeState == null) { throw new RuntimeException(Constants.CACHE_MISS_ERROR); } LongLongArrayMap indexMap = (LongLongArrayMap) currentNodeState.get(this._resolver.stringToHash(indexName, false)); if (indexMap != null) { Query flatQuery = _graph.newQuery(); final NodeState toIndexNodeState = this._resolver.resolveState(nodeToIndex); for (int i = 0; i < keyAttributes.length; i++) { String attKey = keyAttributes[i]; Object attValue = toIndexNodeState.getFromKey(attKey); if (attValue != null) { flatQuery.add(attKey, attValue.toString()); } else { flatQuery.add(attKey, null); } } //TODO AUTOMATIC UPDATE indexMap.remove(flatQuery.hash(), nodeToIndex.id()); } if (Constants.isDefined(callback)) { callback.on(true); } }
private void internal_add_remove(boolean isIndex, Node node, String... attributeNames) { Query flatQuery = node.graph().newQuery(); final NodeState toIndexNodeState = node.graph().resolver().resolveState(node); for (int i = 0; i < attributeNames.length; i++) { final String attKey = attributeNames[i]; final Object attValue = toIndexNodeState.getFromKey(attKey); if (attValue != null) { flatQuery.add(attKey, attValue.toString()); } else { flatQuery.add(attKey, null); } } if (isIndex) { put(flatQuery.hash(), node.id()); } else { delete(flatQuery.hash(), node.id()); } }
for (int i = 0; i < keyAttributes.length; i++) { String attKey = keyAttributes[i]; Object attValue = toIndexNodeState.getFromKey(attKey); if (attValue != null) { flatQuery.add(attKey, attValue.toString());