Hi all,
I've been trying to use the Java API to obtain indexed records and got
myself in a bit of a problem.
I'm using version 2.0.8
on OrientBaseGraph there is a method called getVertexByKey.
javadoc for it says:
*Vertex
com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertexByKey(String
iKey, Object iValue)*
*Lookup for a vertex by id using an index.*
*Example: Vertex v = getVertexByIndex("V.name", "name", "Jay"); *
*Parameters:*
* iKey Name of the indexed property*
* iValue Field value*
*Returns:*
* Vertex instance if found, otherwise null*
Apart from the apparent wrong example in JavaDoc, that refers to a non
existent (probably older) getVertexByIndex method, the method seems to work
fine in these conditions:
1. index is unique
2. index is created for a single field
while first point is understandable as the method returns a single Vertex
node, for the second point I need help in expressing the key for indexes on
multiple fields.
I have a node A with two fields s of type string and i of type integer.
Index name is A.s_i
In the web UI whenever I write the query as:
select rid from index:A.s_i where key = ['A', 1]
the query succeeds and has expected result.
if I attempt to retrieve the value with the same key from java, using
getVertexByKey, I don't get any results:
My attempts so far in writing the key are:
graph.getVertexByIndex("A.s_i", new Object[]{"A", 1})
graph.getVertexByIndex("A.s_i", "['A',1]")
also tried with a List<Object> as key, but no results.
Looks like I'm fighting the API so it is probably something that I'm doing
wrong, but I'm a bit lost about what is the right path. Could you please
help me with this?
Thank you,
Adrian
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.