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?

Ian.

-- 
Email: [EMAIL PROTECTED]
Cell: +1 512 422 3588
Skype: sanity
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to