Zip file uri's / hashtable



Hi,

I now have beagle indexing zip files (without gnome-vfs), and there's a
little problem which effects a lot of beagle. 

A typical zip file uri is:
file:///home/adam/my_zip_file.tar.gz#gzip:#tar:my_folder/a_file.jpg

but using System.Uri this is equal to:
file:///home/adam/my_zip_file.tar.gz

and:
file:///home/adam/my_zip_file.tar.gz:#tar:my_folder/another_file.jpg

This means all the uri keyed hashtables in beagle (HitRegulator.cs,
LuceneDriver.cs, QueryImpl.cs, QueryResult.cs) think all the "zip file
uris" are the same.

Currently I am using 

public class UriComparer : IComparer {
  public int Compare(object uri1, object uri2)  {
    return String.Compare(uri1.ToString(), uri2.ToString());
  }
}

public class UriHasher : IHashCodeProvider {
  public int GetHashCode(object o) {
    return o.ToString().GetHashCode();
  }
}

and "new Hashtable (new UriHasher(), new UriComparer());" on all
uri-keyed hashtables. Alternatively beagle could use an internal format
to specify a zip file (which doesn't have a # in it).

Is there a preferred approach?

Adam





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]