public Object call(ODatabaseDocumentInternal database) { return indexOne.get(indexKey); } });
private OEdge getExistingEdge(OVertex currentFrom, OVertex currentTo) { Object key = uniqueIndex.getDefinition().createValue(currentFrom.getIdentity(), currentTo.getIdentity()); Object result = uniqueIndex.get(key); if (result instanceof ORID) { result = ((ORID) result).getRecord(); } if (result instanceof OElement) { return ((OElement) result).asEdge().get(); } return null; }
@Override public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) { if (!index.getType().toLowerCase().contains("fulltext")) { return null; } if (index.getAlgorithm() == null || !index.getAlgorithm().toLowerCase().contains("lucene")) { return null; } Set<OIdentifiable> indexResult = (Set<OIdentifiable>) index .get(new OLuceneKeyAndMetadata(new OLuceneCompositeKey(keyParams).setContext(iContext), new ODocument())); if (indexResult == null) return new OIndexCursorSingleValue((OIdentifiable) indexResult, new OLuceneCompositeKey(keyParams)); return new OIndexCursorCollectionValue(indexResult, new OLuceneCompositeKey(keyParams)); }
public Object call(ODatabaseDocumentInternal database) { return indexTwo.get(indexKey); } });
public T get(final Object iKey) { return delegate.get(iKey); }
public long count(final String key, final Object value) { final String keyTemp = key + SEPARATOR + value; final Collection<OIdentifiable> records = (Collection<OIdentifiable>) underlying.get(keyTemp); if (records == null) return 0; return records.size(); }
public long count(final String key, final Object value) { final String keyTemp = key + SEPARATOR + value; final Collection<OIdentifiable> records = (Collection<OIdentifiable>) underlying.get(keyTemp); return records.size(); }
public <RET extends T> RET get(final String iKey) { final OIdentifiable value = index.get(iKey); if (value == null) return null; return (RET) value.getRecord(); }
/** * {@inheritDoc} */ @Override public T get(Object iKey) { final Object lastIndexResult = lastIndex.get(iKey); final Set<OIdentifiable> result = new HashSet<OIdentifiable>(); if (lastIndexResult != null) result.addAll(applyTailIndexes(lastIndexResult)); return (T) result; }
private Stream<OIdentifiable> lookupInIndex(OIndex<Object> index, Object value) { Object fromIndex = index.get(value); if (fromIndex instanceof Iterable) return StreamUtils.asStream(((Iterable<OIdentifiable>) fromIndex).iterator()); else return Stream.of((OIdentifiable) fromIndex); }
@SuppressWarnings("rawtypes") public CloseableIterable<T> get(final String key, final Object iValue) { final String keyTemp = key + SEPARATOR + iValue; Collection<OIdentifiable> records = (Collection<OIdentifiable>) underlying.get(keyTemp); if (records == null || records.isEmpty()) return new WrappingCloseableIterable(Collections.emptySet()); return new OrientElementIterable<T>(graph, records); }
@Override public OIdentifiable convert(OIdentifiable value) { final ORID rid = value.getIdentity(); if (!rid.isPersistent()) return value; if (converterData.brokenRids.contains(rid)) return OImportConvertersFactory.BROKEN_LINK; final OIdentifiable newRid = converterData.exportImportHashTable.get(rid); if (newRid == null) return value; return newRid.getIdentity(); } }
private <V> V getRecord(final Comparable<?> indexKey, final Function<? super OIdentifiable, ? extends V> transform) { final OClass documentClass = getDocumentClass(); final OIdentifiable recordId = DBUtils.supplyWithDatabase(database, () -> (OIdentifiable) documentClass.getClassIndex(indexName).get(PersistentFieldDefinition.getCompositeKey(indexKey))); return recordId == null ? null : transform.apply(recordId); }
@Override public ORID map(ORID rid) { if (rid == null) return null; if (!rid.isPersistent()) return null; databaseTwo.activateOnCurrentThread(); final OIdentifiable result = exportImportHashTable.get(rid); if (result == null) return null; return result.getIdentity(); } };
public <RET extends T> RET get(final String iKey, final String iFetchPlan) { final OIdentifiable value = index.get(iKey); if (value == null) return null; if (value instanceof ORID) return (RET) ODatabaseRecordThreadLocal.instance().get().load(((ORID) value), iFetchPlan); return (RET) ((ODocument) value).load(iFetchPlan); }
@Override public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) { OIndexCursor cursor; Object indexResult = index.get(new OFullTextCompositeKey(keyParams).setContext(iContext)); if (indexResult == null || indexResult instanceof OIdentifiable) cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OFullTextCompositeKey(keyParams)); else cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OFullTextCompositeKey( keyParams)); iContext.setVariable("$luceneIndex", true); return cursor; }
protected ODocument getODocumentByHostId(OrientGraph graph, String index, String host, String id) { ODocument doc = null; OIndex<?> hostIdIdx = graph.getRawGraph().getMetadata().getIndexManager().getIndex(index); // this is a unique index, so it retrieves a OIdentifiable OCompositeKey key = new OCompositeKey(host, id); OIdentifiable oid = (OIdentifiable) hostIdIdx.get(key); if (oid != null) { doc = (ODocument)oid.getRecord(); } return doc; }
public OrientVertex getConfigByHostId(OrientGraph graph, String host, String configId) { OrientVertex config = null; OIndex<?> hostIdIdx = graph.getRawGraph().getMetadata().getIndexManager().getIndex("configHostIdIdx"); OCompositeKey key = new OCompositeKey(host, configId); OIdentifiable oid = (OIdentifiable) hostIdIdx.get(key); if (oid != null) { config = graph.getVertex(oid.getRecord()); } return config; }
public OrientVertex getBranchByHostId(OrientGraph graph, String branchType, String host, String categoryId) { OrientVertex branch = null; OIndex<?> hostIdIdx = graph.getRawGraph().getMetadata().getIndexManager().getIndex(branchType + "HostIdIdx"); OCompositeKey key = new OCompositeKey(host, categoryId); OIdentifiable oid = (OIdentifiable) hostIdIdx.get(key); if (oid != null) { branch = graph.getVertex(oid.getRecord()); } return branch; }
@Override public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) { Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setOperation(SpatialOperation.IsWithin)); iContext.setVariable("$luceneIndex", true); if (indexResult == null || indexResult instanceof OIdentifiable) return new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams)); return new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(keyParams)); }