On Wednesday 13 August 2008 12:44, Ian Clarke wrote:
> On Sun, Aug 10, 2008 at 12:44 PM, <[EMAIL PROTECTED]> wrote:
> > public Identity getIdentityByURI(FreenetURI uri) {
> >
> > + String searched = uri.toString().substring(0,
uri.toString().indexOf("/"));
> > Identity identity = null;
> >
> > // This is ugly, I could not find a request able to find
the good identity
> > ObjectSet<Identity> search =
db.queryByExample(Identity.class);
> > while (search.hasNext()) {
> > Identity id = search.next();
> > -
if(id.getRequestURI().getRoutingKey().equals(uri.getRoutingKey())) {
> > + String found =
id.getRequestURI().toString().substring(0,
id.getRequestURI().toString().indexOf("/"));
> > + if(found.equals(searched)) {
> > identity = id;
> > break;
> > }
>
> Ouch, this could be extremely inefficient, how many Identity objects
> is this going to search through? Isn't there some way to do this that
> will allow db4o to use an index?The best way I have found is to make a string member and then search for that. Most obvious ways of doing this result in db4o instantiating every object itself in order to compare... > > Ian.
pgp5LAJDl0VjF.pgp
Description: PGP signature
_______________________________________________ Devl mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
