lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin A. Burton" <bur...@newsmonster.org>
Subject Re: DocumentWriter, StopFilter should use HashMap... (patch)
Date Wed, 10 Mar 2004 03:23:08 GMT
Erik Hatcher wrote:

> Kevin - I've made this change and committed it, using a Set.
>
> Let me know if there are any issues with what I've committed - I 
> believe I've faithfully preserved backwards compatibility.

Actually... Erik.. I don't think your Hashtable constructor will work...

By default Hashtable.keySet returns a SynchronizedSet. (on JDK 1.4.2). 
so were're back to where we started:

>  public StopFilter(TokenStream in, Hashtable stopTable) {
>    super(in);
>    table = stopTable.keySet();
>  }
>  
>
You need do make it a HashSet:

   table = new HashSet( stopTable.keySet() );

Also... while you're at it... the private variable name is 'table' which 
this HashSet certainly is *not* ;)

Probably makes sense to just call this variable 'hashset' and then force 
the type to be HashSet since it's necessary for this to be a HashSet to 
maintain any decent performance.  You'll need to update your second 
constructor to require a HashSet too.. would be very bad to let callers 
use another set impl... TreeSet and SortedSet would still be too slow...

Anyway... I had this feature in my patch ;)

Thanks!

Kevin

-- 

Please reply using PGP.

    http://peerfear.org/pubkey.asc    
    
    NewsMonster - http://www.newsmonster.org/
    
Kevin A. Burton, Location - San Francisco, CA, Cell - 415.595.9965
       AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
  IRC - freenode.net #infoanarchy | #p2p-hackers | #newsmonster


Mime
View raw message