Skip to content

Instantly share code, notes, and snippets.

@giastfader
Created September 13, 2012 13:39
Show Gist options
  • Select an option

  • Save giastfader/3714347 to your computer and use it in GitHub Desktop.

Select an option

Save giastfader/3714347 to your computer and use it in GitHub Desktop.
[OrientDb] using the index java api
//from: https://groups.google.com/forum/?fromgroups=#!searchin/orient-database/OIdentifiable/orient-database/fwAmlTJy4-c/ne3wpgbSJOEJ
public static ODocument getDoc(String name){
OGraphDatabase db = OGraphDatabase ((ODatabaseRecordTx)ODatabaseRecordThreadLocal.INSTANCE.get());
OIndex idx = db.getMetadata().getIndexManager().getIndex("doc.name"); //<<---- the index name
ORecordId record = (ORecordId) idx.get( name );
return (ODocument) record.getRecord();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment