LUCENE-2524: FastVectorHighlighter: use mod for getting colored tag

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@960349 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Koji Sekiguchi 2010-07-04 15:58:54 +00:00
parent 5ba4331613
commit 350ae952d7
2 changed files with 11 additions and 3 deletions

View File

@ -86,6 +86,9 @@ Bug fixes
* LUCENE-2404: Fix bugs with position increment and empty tokens in ThaiWordFilter.
For matchVersion >= 3.1 the filter also no longer lowercases. ThaiAnalyzer
will use a separate LowerCaseFilter instead. (Uwe Schindler, Robert Muir)
* LUCENE-2524: FastVectorHighlighter: use mod for getting colored tag.
(Koji Sekiguchi)
API Changes

View File

@ -36,7 +36,10 @@ public abstract class BaseFragmentsBuilder implements FragmentsBuilder {
"<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 BaseFragmentsBuilder implements FragmentsBuilder {
}
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];
}
}