Indexing and getSingle index name

0 views
Skip to first unread message

Valère T

unread,
Jun 9, 2010, 9:11:46 AM6/9/10
to jo4neo
Hi there!

Currently testing this amazing thing....

I just wanted here to share this:

I've got the following classes:

package Model;
public class User extends SomeBaseClass {
transient Nodeid node;

@neo
public String lastname;
@neo
public String firstname;
}


package Model;
public class SomeBaseClass {
// used by jo4neo
transient public Nodeid node;

@neo(index = true)
public String id;
@neo(index = true)
public String name;
}


User is indexed with his name, so I tried to get a user by his name
with the following line

graph.getSingle(User.class, "name", name);

but this did not work; one has to write:

user = graph.getSingle(User.class, "Model.User.name_INDEX", name);


.. as the index name is defined in FieldContext as:
public String getIndexName() {
return subject.getClass().getName() + '.' + field.getName() +
INDEX;
}



Maybe getSingle could be changed to get the full name index by
itself...
Or is there another approach ?

Thanks.





Taylor Cowan

unread,
Jun 12, 2010, 9:22:15 AM6/12/10
to jo4...@googlegroups.com
Ah yes, jo4neo puts "name" within context of the class so that the
index doesn't collide with another name from another class.

Looking at the example, "name" is clearly meant within context of the
"User" class, and therefore jo4neo could simplify this. It already
does something similar with find.where(User.name).is(...)

I need to try these examples out, be back shortly...

Taylor

Reply all
Reply to author
Forward
0 new messages