lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Veentjer - Anchor Men" <p.veent...@anchormen.nl>
Subject FW: CVS Lucene 2.0
Date Tue, 26 Apr 2005 13:45:19 GMT
 

-----Oorspronkelijk bericht-----
Van: Peter Veentjer - Anchor Men 
Verzonden: dinsdag 26 april 2005 15:44
Aan: 'Daniel Naber'
Onderwerp: RE: CVS Lucene 2.0

 

-----Oorspronkelijk bericht-----
Van: Daniel Naber [mailto:daniel.naber@intrafind.de]
Verzonden: dinsdag 26 april 2005 15:36
Aan: Peter Veentjer - Anchor Men
Onderwerp: Re: CVS Lucene 2.0

On Tuesday 26 April 2005 15:12, Peter Veentjer - Anchor Men wrote:

> Btw:
> I would like to improve the MultiFieldQueryParser. The code is
strange..

This should be mostly fixed in the development version. Let me know
(i.e. post to the list) if something is still wrong. Note that there
might be some "strange" or "broken" methods around, but these should be
deprecated.

Ok.. I`ll post it (maybe this evening if I have time)..

I`m looking through the code at this moment and have a few remarks:

1) there are a lot of final methods that don`t need to be finalized (the
class is finallized, so the all the methods are finallized).

2) I have looked at the equals method of Term, and it could be improved
also:


Original Term.equals:

	public boolean equals(Object o) {
		if (o == null)
			return false;
	
		Term other = (Term) o;
		return field == other.field && text.equals(other.text);
	}
	
New:

	public boolean equals(Object o) {
		if (o == this)
			return true;

		if(!(o instanceof Term))
			return false;	
			
		Term other = (Term) o;
		return field.equals(other.field) &&
text.equals(other.text);
	}

First if an object is checked with itself... No internal checking is
needed.
Two: if an object is tested with a class of a different type (or null)
the result is false. 
Third: if the field values of refer to the same text but to different
object, the result should be the same.



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


Mime
View raw message