lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <markharw...@yahoo.co.uk>
Subject Re: Is this correct: term.field() == fieldName ?
Date Wed, 21 Mar 2007 13:30:30 GMT
>>Is it correct to compare using '==' or equals should be used instead?

In this context it is OK. Term fieldnames are deliberately interned using String.intern()
so this equality test can be used. 
The intention is to make comparisons faster.

Cheers,
Mark

----- Original Message ----
From: dmitri <evysq@mail.ru>
To: java-dev@lucene.apache.org
Sent: Wednesday, 21 March, 2007 12:04:27 PM
Subject: Is this correct: term.field() == fieldName ?


In the org.apache.lucene.search.PrefixFilter I've found: 
......
       if (term != null &&
            term.text().startsWith(prefixText) &&
            term.field() == prefixField)
        {
........................
Is it correct to compare using '==' or equals should be used instead?
-------------
Dmitri.

-- 
View this message in context: http://www.nabble.com/Is-this-correct%3A-term.field%28%29-%3D%3D-fieldName---tf3440232.html#a9592526
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.


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






	
	
		
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo!
Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 

---------------------------------------------------------------------
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