On Sun, Aug 10, 2008 at 12:44 PM,  <batosai at freenetproject.org> 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: ian at uprizer.com
Cell: +1 512 422 3588
Skype: sanity

Reply via email to