use of org.janusgraph.graphdb.query.graph.MultiKeySliceQuery in project janusgraph by JanusGraph.
the class IndexSerializer method query.
/* ################################################
Querying
################################################### */
public Stream<Object> query(final JointIndexQuery.Subquery query, final BackendTransaction tx) {
final IndexType index = query.getIndex();
if (index.isCompositeIndex()) {
final MultiKeySliceQuery sq = query.getCompositeQuery();
final List<EntryList> rs = sq.execute(tx);
final List<Object> results = new ArrayList<>(rs.get(0).size());
for (final EntryList r : rs) {
for (final java.util.Iterator<Entry> iterator = r.reuseIterator(); iterator.hasNext(); ) {
final Entry entry = iterator.next();
final ReadBuffer entryValue = entry.asReadBuffer();
entryValue.movePositionTo(entry.getValuePosition());
switch(index.getElement()) {
case VERTEX:
results.add(VariableLong.readPositive(entryValue));
break;
default:
results.add(bytebuffer2RelationId(entryValue));
}
}
}
return results.stream();
} else {
return tx.indexQuery(index.getBackingIndexName(), query.getMixedQuery()).map(IndexSerializer::string2ElementId);
}
}
Aggregations