lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: BooleanQuery.equals() change
Date Tue, 12 Apr 2005 10:32:43 GMT

On Apr 11, 2005, at 5:57 PM, Yonik Seeley wrote:
> Erik, why was the last change to BooleanQuery made?
> The comment was "Correct BooleanQuery.equals such that every clause is
> compared".
>
> It looks like Vector.equals() should have worked, and the new code is
> probably slower as it creates two new arrays.

Vector.equals() compares the Vector object instances and is only true 
if they are the same object - it does not compare the contents of the 
Vector for equality at that level.  Try it out with some test cases.

Where in the .equals that I added are two arrays being created?

   public boolean equals(Object o) {
     if (!(o instanceof BooleanQuery))
       return false;
     BooleanQuery other = (BooleanQuery)o;
     return (this.getBoost() == other.getBoost())
       &&  Arrays.equals(this.getClauses(), other.getClauses());
   }

It's especially risky on this list to use the word "probably" when 
talking about speed. :)  Is it really slower?

I'm more than happy to adjust the .equals method to something better; 
do you have a specific improvement?

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message