lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carl...@apache.org
Subject cvs commit: jakarta-lucene-sandbox/contributions/searchbean/src/java/org/apache/lucene/beans CompareDocumentsByField.java
Date Thu, 23 May 2002 00:44:53 GMT
carlson     02/05/22 17:44:53

  Added:       contributions/searchbean/src/java/org/apache/lucene/beans
                        CompareDocumentsByField.java
  Log:
  Initial submit of SerachBean and related classes
  
  Revision  Changes    Path
  1.1                  jakarta-lucene-sandbox/contributions/searchbean/src/java/org/apache/lucene/beans/CompareDocumentsByField.java
  
  Index: CompareDocumentsByField.java
  ===================================================================
  package org.apache.lucene.beans;
  
  import org.apache.lucene.document.Document;
  import org.apache.lucene.document.DateField;
  import org.apache.lucene.beans.IndividualHit;
  import java.util.Date;
  
  //import org.apache.log4j.Logger;
  
  public class CompareDocumentsByField implements java.util.Comparator
  {
         // static private Logger logger = Logger.getLogger(CompareDocumentsByDate.class.getName());
  	public CompareDocumentsByField()
  	{
  	}
  	
  	public int compare(Object hit1, Object hit2)
  	{
  		String myDate1 = ((IndividualHit)hit1).getField();
  		String myDate2 = ((IndividualHit)hit2).getField();
                  if ((myDate1 == null) || (myDate2 == null)){
                      //logger.error("A date was null, the score is "+((IndividualHit) hit1).getScore());
                      //return -1;
                  }
  		return -1*(myDate1.compareTo(myDate2)); 	//sort in descending order
  	}
  	
  	public boolean equals(Object o1)
  	{
  		return false;
  	}
  }
  
  

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


Mime
View raw message