WEIRD: index name seems MATTER... different behaviors when you name it differently!

12 views
Skip to first unread message

Ranqi Zhu

unread,
May 24, 2013, 1:33:37 PM5/24/13
to gremli...@googlegroups.com
Version 1:
build index like this:
Index<Vertex> indexName = ((IndexableGraph)m_dbg).createIndex("name", Vertex.class);
indexName.put("name", name, v);

get index like this
Index<Vertex> index = ((IndexableGraph)m_dbg).getIndex("name",Vertex.class);
Vertex from =  index.get("name", name).iterator().next();

This code works, but problem is the index's name is "name", and under orientdb's console, when you query on V, it does not use it at all.Query is still slow.
It seems the system expect "V.name" instead.




so
Version 2:
build index like this:
Index<Vertex> indexName = ((IndexableGraph)m_dbg).createIndex("V.name", Vertex.class);
indexName.put("name", name, v);

get index like this
Index<Vertex> index = ((IndexableGraph)m_dbg).getIndex("V.name",Vertex.class);
Vertex from =  index.get("name", name).iterator().next();

In this case, index created is "V.name", under oriendb console, query on V is much faster, apparently system recognizs the index.
Howeever weird thing is: index.get("name", name) return empty.




I also tried
Index<Vertex> indexName = ((IndexableGraph)m_dbg).createIndex("V.name", Vertex.class);
indexName.put("V.name", name, v);

get index like this
Index<Vertex> index = ((IndexableGraph)m_dbg).getIndex("V.name",Vertex.class);
Vertex from =  index.get("V.name", name).iterator().next();

index.get still returns empty... query in console is fast.
In this case, the only different thing comparing to version 1 is, "name" becomes "V.name".

Reply all
Reply to author
Forward
0 new messages