I actually just came back to attempt to do that. I now have a similar issue with the .get() function. It's always returning false, even if the key does in fact exist. I'm pretty sure it's an issue with my DB, not the API. Since it seems to just be randomly not working. Sometimes it does, sometimes it doesn't. Is there something special I have to do with the indexes that I'm not realizing?
I have 4 indexes currently, all of which were created like this:
1. Create the class, insert data.
2. Execute "CREATE PROPERTY <classname>.<field> String" from the terminal, where I know that every document in the class has that field.
3. Execute "CREATE INDEX <classname>.<field> UNIQUE" from the terminal.
4. Execute "REBUILD INDEX index:<idx>" form the terminal.
After that, I can do a "SELECT FROM index:..." and it all shows up just fine. And then it sometimes works in the Java API, but sometimes not. For example, I have a class called InvitationTokens that has 118 documents in it, and therefore, 118 records in the corresponding index. This morning, everything was working perfectly. But now, it started failing. I go to the terminal and do a "SELECT FROM index:..." and I get 0 results. (I just had 118!) I do a rebuild and it works fine. 10 minutes later, I have the same problem with the RegistartionTokens index, but rebuilding it DOESN'T work this time.
I'm a little confused really. I know that I'm rambling and not helping much. Hopefully you get the idea. I'd be willing to upload my database too. (It's very small.) Also, just to check my sanity, how should I be using the indexes? Right now, I do it like this:
rawGraph = new OGraphDatabase("...");
rawGraph.open("...", "...");
OIndex<?> idx = rawGraph.getMetadata().getIndexManager().getIndex("...");
//Sometimes, I delete records too...
ODocument d = new ODocument(new ORecordId(idx.get("...").toString()));
rawGraph.delete(d);
rawGraph.close();
Am I not closing things out correctly? Is there some other save/shutdown procedure I should be doing to stop corruption?
Or could the problem be that I created my properties AFTER the classes? Should I go back, deleted the classes, create the properties, THEN add data?
Again, sorry for rambling. I'm just trying to provide as much information as possible. :/
Thanks,
Gordon.