lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tjo...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search FieldSortedHitQueue.java
Date Wed, 17 Mar 2004 18:21:53 GMT
oops - the commit email bounced because I wasn't signed up.  but here it is:

Date: 17 Mar 2004 18:11:02 -0000
Message-ID: <20040317181102.93750.qmail@minotaur.apache.org>
From: tjones@apache.org
To: jakarta-lucene-cvs@apache.org
Subject: cvs commit: jakarta-lucene/src/java/org/apache/lucene/search FieldSortedHitQueue.java
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N

tjones      2004/03/17 10:11:02

  Modified:    src/java/org/apache/lucene/search FieldSortedHitQueue.java
  Log:
  remove java 1.4 dependent code in order to maintain java 1.3 level compatibility
  
  Revision  Changes    Path
  1.5       +25 -4     jakarta-lucene/src/java/org/apache/lucene/search/FieldSortedHitQueue.java
  
  Index: FieldSortedHitQueue.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/FieldSortedHitQueue.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FieldSortedHitQueue.java	27 Feb 2004 12:29:31 -0000	1.4
  +++ FieldSortedHitQueue.java	17 Mar 2004 18:11:02 -0000	1.5
  @@ -23,7 +23,6 @@
   
   import java.io.IOException;
   import java.util.Hashtable;
  -import java.util.regex.Pattern;
   
   /**
    * Expert: Base class for collecting results from a search and sorting
  @@ -84,10 +83,14 @@
       protected static final Hashtable fieldCache = new Hashtable();
   
   	/** The pattern used to detect integer values in a field */
  -	protected static final Pattern pIntegers = Pattern.compile ("[0-9\\-]+");
  +	/** removed for java 1.3 compatibility
  +		protected static final Pattern pIntegers = Pattern.compile ("[0-9\\-]+");
  +	**/
   
   	/** The pattern used to detect float values in a field */
  -	protected static final Pattern pFloats = Pattern.compile ("[0-9+\\-\\.eEfFdD]+");
  +	/** removed for java 1.3 compatibility
  +		protected static final Object pFloats = Pattern.compile ("[0-9+\\-\\.eEfFdD]+");
  +	**/
   
   
   	/**
  @@ -187,12 +190,30 @@
   			if (term.field() == field) {
   				String termtext = term.text().trim();
   
  +				/**
  +				 * Java 1.4 level code:
  +
   				if (pIntegers.matcher(termtext).matches())
   					return IntegerSortedHitQueue.comparator (reader, enumerator, field);
   
   				else if (pFloats.matcher(termtext).matches())
   					return FloatSortedHitQueue.comparator (reader, enumerator, field);
  +				 */
   
  +				// Java 1.3 level code:
  +				try {
  +					Integer.parseInt (termtext);
  +					return IntegerSortedHitQueue.comparator (reader, enumerator, field);
  +				} catch (NumberFormatException nfe) {
  +					// nothing
  +				}
  +				try {
  +					Float.parseFloat (termtext);
  +					return FloatSortedHitQueue.comparator (reader, enumerator, field);
  +				} catch (NumberFormatException nfe) {
  +					// nothing
  +				}
  +				
   				return StringSortedHitQueue.comparator (reader, enumerator, field);
   
   			} else {
  
  
  



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


Mime
View raw message