lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mharw...@apache.org
Subject svn commit: r179637 - /lucene/java/trunk/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenGroup.java
Date Thu, 02 Jun 2005 20:27:07 GMT
Author: mharwood
Date: Thu Jun  2 13:27:06 2005
New Revision: 179637

URL: http://svn.apache.org/viewcvs?rev=179637&view=rev
Log: (empty)

Modified:
    lucene/java/trunk/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenGroup.java

Modified: lucene/java/trunk/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenGroup.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenGroup.java?rev=179637&r1=179636&r2=179637&view=diff
==============================================================================
--- lucene/java/trunk/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenGroup.java
(original)
+++ lucene/java/trunk/contrib/highlighter/src/java/org/apache/lucene/search/highlight/TokenGroup.java
Thu Jun  2 13:27:06 2005
@@ -34,19 +34,22 @@
 
 	void addToken(Token token, float score)
 	{
-		if(numTokens==0)
-		{
-			startOffset=token.startOffset();		
-			endOffset=token.endOffset();		
-		}
-		else
-		{
-			startOffset=Math.min(startOffset,token.startOffset());		
-			endOffset=Math.max(endOffset,token.endOffset());		
-		}
-		tokens[numTokens]=token;
-		scores[numTokens]=score;
-		numTokens++;
+	    if(numTokens < MAX_NUM_TOKENS_PER_GROUP)
+        {	    
+			if(numTokens==0)
+			{
+				startOffset=token.startOffset();		
+				endOffset=token.endOffset();		
+			}
+			else
+			{
+				startOffset=Math.min(startOffset,token.startOffset());		
+				endOffset=Math.max(endOffset,token.endOffset());		
+			}
+			tokens[numTokens]=token;
+			scores[numTokens]=score;
+			numTokens++;
+        }
 	}
 	
 	boolean isDistinct(Token token)
@@ -116,5 +119,4 @@
 		}
 		return total;
 	}
-
 }



Mime
View raw message