@Override public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) { OIndexCursor cursor; Object key; key = keyParams.get(0); Map<String, Object> queryParams = new HashMap<String, Object>(); queryParams.put(SpatialQueryBuilderAbstract.GEO_FILTER, SpatialQueryBuilderOverlap.NAME); queryParams.put(SpatialQueryBuilderAbstract.SHAPE, key); long start = System.currentTimeMillis(); OLuceneResultSet indexResult = (OLuceneResultSet) index.get(queryParams); if (indexResult != null) indexResult.sendLookupTime(iContext, start); if (indexResult == null || indexResult instanceof OIdentifiable) return new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams)); return new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(keyParams)); }
@Override public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) { OIndexDefinition definition = index.getDefinition(); int idxSize = definition.getFields().size(); int paramsSize = keyParams.size(); OIndexCursor cursor; Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setOperation(SpatialOperation.IsWithin)); if (indexResult == null || indexResult instanceof OIdentifiable) cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams)); else cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OSpatialCompositeKey( keyParams)); iContext.setVariable("$luceneIndex", true); return cursor; }
@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; }
cursor = (OIndexCursor) indexResult; } else { cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, inKeys);
@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)); }
@Override public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) { OIndexCursor cursor; OIndexDefinition definition = index.getDefinition(); int idxSize = definition.getFields().size(); int paramsSize = keyParams.size(); double distance = 0; Object spatial = iContext.getVariable("spatial"); if (spatial != null) { if (spatial instanceof Number) { distance = ((Double) OType.convert(spatial, Double.class)).doubleValue(); } else if (spatial instanceof Map) { Map<String, Object> params = (Map<String, Object>) spatial; Object dst = params.get("maxDistance"); if (dst != null && dst instanceof Number) { distance = ((Double) OType.convert(dst, Double.class)).doubleValue(); } } } iContext.setVariable("$luceneIndex", true); Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setMaxDistance(distance).setContext(iContext)); if (indexResult == null || indexResult instanceof OIdentifiable) return new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams)); return new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(keyParams)); }
@Override public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) { OIndexCursor cursor; OIndexDefinition definition = index.getDefinition(); int idxSize = definition.getFields().size(); int paramsSize = keyParams.size(); double distance = 0; Object spatial = iContext.getVariable("spatial"); if (spatial != null) { if (spatial instanceof Number) { distance = ((Double) OType.convert(spatial, Double.class)).doubleValue(); } else if (spatial instanceof Map) { Map<String, Object> params = (Map<String, Object>) spatial; Object dst = params.get("maxDistance"); if (dst != null && dst instanceof Number) { distance = ((Double) OType.convert(dst, Double.class)).doubleValue(); } } } Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setMaxDistance(distance).setContext(iContext)); if (indexResult == null || indexResult instanceof OIdentifiable) cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams)); else cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OSpatialCompositeKey( keyParams)); iContext.setVariable("$luceneIndex", true); return cursor; }
@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)); }
@Override public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) { final OIndexDefinition indexDefinition = index.getDefinition(); if (indexDefinition.getParamCount() > 1) return null; final OIndex<?> internalIndex = index.getInternal(); OIndexCursor cursor; if (internalIndex instanceof OIndexFullText) { final Object key = indexDefinition.createValue(keyParams); final Object indexResult = index.get(key); if (indexResult == null || indexResult instanceof OIdentifiable) cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, key); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, key); } else return null; updateProfiler(iContext, internalIndex, keyParams, indexDefinition); return cursor; }
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, key); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, key); } else { cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, keyOne); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, keyOne); } else return null;
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, key); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, key); } else { cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, keyOne); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, keyOne); } else return null;
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, key); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, key); } else { cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, keyOne); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, keyOne); } else return null;
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, key); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, key); } else { cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, keyOne); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, keyOne); } else return null;
if (nullValue instanceof Collection) cursors.add(OIndexChangesWrapper .wrap(index, new OIndexCursorCollectionValue((Collection) nullValue, null), indexRebuildVersion)); else cursors.add(OIndexChangesWrapper
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, key); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, key); } else { cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, keyOne); else cursor = new OIndexCursorCollectionValue((Collection<OIdentifiable>) indexResult, keyOne); } else return null;