You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by ko...@apache.org on 2010/10/29 19:06:53 UTC

svn commit: r1028850 - in /lucene/java/branches/lucene_2_9/contrib: CHANGES.txt fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java

Author: koji
Date: Fri Oct 29 17:06:52 2010
New Revision: 1028850

URL: http://svn.apache.org/viewvc?rev=1028850&view=rev
Log:
LUCENE-2524: FastVectorHighlighter: use mod for getting colored tag 

Modified:
    lucene/java/branches/lucene_2_9/contrib/CHANGES.txt
    lucene/java/branches/lucene_2_9/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java

Modified: lucene/java/branches/lucene_2_9/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/contrib/CHANGES.txt?rev=1028850&r1=1028849&r2=1028850&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/contrib/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_9/contrib/CHANGES.txt Fri Oct 29 17:06:52 2010
@@ -13,6 +13,9 @@ Bug Fixes
  * LUCENE-2278: FastVectorHighlighter: Highlighted term is out of alignment
    in multi-valued NOT_ANALYZED field. (Koji Sekiguchi)
 
+ * LUCENE-2524: FastVectorHighlighter: use mod for getting colored tag.
+   (Koji Sekiguchi)
+
 Documentation
 
  * LUCENE-2055: Add documentation noting that the Dutch and French stemmers

Modified: lucene/java/branches/lucene_2_9/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java?rev=1028850&r1=1028849&r2=1028850&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java (original)
+++ lucene/java/branches/lucene_2_9/contrib/fast-vector-highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java Fri Oct 29 17:06:52 2010
@@ -36,7 +36,10 @@ public abstract class BaseFragmentsBuild
     "<b style=\"background:yellow\">", "<b style=\"background:lawngreen\">", "<b style=\"background:aquamarine\">",
     "<b style=\"background:magenta\">", "<b style=\"background:palegreen\">", "<b style=\"background:coral\">",
     "<b style=\"background:wheat\">", "<b style=\"background:khaki\">", "<b style=\"background:lime\">",
-    "<b style=\"background:deepskyblue\">"
+    "<b style=\"background:deepskyblue\">", "<b style=\"background:deeppink\">", "<b style=\"background:salmon\">",
+    "<b style=\"background:peachpuff\">", "<b style=\"background:violet\">", "<b style=\"background:mediumpurple\">",
+    "<b style=\"background:palegoldenrod\">", "<b style=\"background:darkkhaki\">", "<b style=\"background:springgreen\">",
+    "<b style=\"background:turquoise\">", "<b style=\"background:powderblue\">"
   };
   public static final String[] COLORED_POST_TAGS = { "</b>" };
   
@@ -145,10 +148,12 @@ public abstract class BaseFragmentsBuild
   }
   
   protected String getPreTag( int num ){
-    return preTags.length > num ? preTags[num] : preTags[0];
+    int n = num % preTags.length;
+    return preTags[n];
   }
   
   protected String getPostTag( int num ){
-    return postTags.length > num ? postTags[num] : postTags[0];
+    int n = num % postTags.length;
+    return postTags[n];
   }
 }