This works fine now, but I am still looking for method of FAST access as 
claimed on Stackoverflow thread 
<http://stackoverflow.com/questions/10970556/orientdb-graphdatabase-osqlsynchquery-for-rid-to-get-graph-getvertexrid?rq=1>

OIndex<?> nameIdx = graph.getRawGraph().getMetadata().getIndexManager().
getIndex("idxtest2");
                Object luke = (Object)nameIdx.get( "06615119" );
                System.out.println(luke);




On Thursday, March 13, 2014 4:52:08 PM UTC+5:30, Shishya wrote:
>
> Hi,
>
> Can someone please help with getting/querying index by key. I m using 
> 1.7rc2SS.
> I created a notunique index on vertex with string property from console. 
>
> Create index idxtest2 on myclass(ID) notunique
>
> OrientGraphFactory factory = new OrientGraphFactory("remote:local/test2",
> "root","password").setupPool(1, 10);
> OrientGraph graph = factory.getTx();
>
> Index idx = 
> graph.getRawGraph().getMetadata().getIndexManager().getIndex("idxtest2");
> ORID key = idx.get("indexKey");
> or 
> Index<Vertex> index = graph.getIndex("idxtest2", Vertex.class);
> Iterable<Vertex> results = index.get("ID","06615119"); OR Iterable<Vertex> 
> results = index.get("key","06615119");
>
>
> Errors on these scenarios are like
>                 ORID key = idx.get("indexKey");
>                               ^
>   required: String,Object
>   found: String
>   reason: actual and formal argument lists differ in length
>   where T is a type-variable:
>     T extends Element declared in interface Index
> 2 errors
>
> Exception in thread "main" java.lang.NullPointerException
> at ClassConnect.main(ClassConnect.java:104)
>
>
>
>
>
> On Friday, August 17, 2012 3:10:27 PM UTC+5:30, Gabriel Vince wrote:
>>
>> Hi Gordon,
>>
>> correct usage of indexes in API is as follows:
>> OIndex idx = db.getMetadata().getIndexManager().getIndex(indexName);
>> ORID key = (ORecordId).get(indexKey);
>>
>> where the key will be null in the index is not found 
>>
>> Carpe diem
>>             Gabriel
>>  
>>
>>> This is the code that is failing on me:
>>>
>>> OIndex<?> userIndex = 
>>> rawGraph.getMetadata().getIndexManager().getIndex(user_index /* 
>>> "Users.username" */);
>>>
>>> if (userIndex.contains(username))
>>> {
>>> //username taken
>>> }
>>>
>>> No matter what, it always returns true. But if I were to do a 
>>> rawGraph.query() with "SELECT FROM index...", it would return the correct 
>>> result. Is this an API bug or a user error?
>>>
>>> Thanks,
>>> Gordon.
>>>
>>
>>

-- 

--- 
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.

Reply via email to