Skip to content

Apache Lucene open-source search software

LUCENE-1719: Add javadoc notes about ICUCollationKeyFilter's advantages over CollationKeyFilter (Steven Row via Simon Willnauer)

Simon Willnauer410afb98bfcb
diff --git a/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyAnalyzer.java b/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyAnalyzer.java
index bf622796a73..bd7614e99b4 100644
--- a/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyAnalyzer.java
+++ b/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyAnalyzer.java
@@ -59,12 +59,17 @@ import java.io.IOException;
* </li>
* </ol>
* <p>
- * NB 1: {@link ICUCollationKeyAnalyzer} uses ICU4J's Collator, which makes
+ * {@link ICUCollationKeyAnalyzer} uses ICU4J's Collator, which makes
* its version available, thus allowing collation to be versioned
- * independently from the JVM.
+ * independently from the JVM. ICUCollationKeyAnalyzer is also significantly
+ * faster and generates significantly shorter keys than CollationKeyAnalyzer.
+ * See <a href="http://site.icu-project.org/charts/collation-icu4j-sun"
+ * >http://site.icu-project.org/charts/collation-icu4j-sun</a> for key
+ * generation timing and key length comparisons between ICU4J and
+ * java.text.Collator over several languages.
* </p>
* <p>
- * NB 2: CollationKeys generated by java.text.Collators are not compatible
+ * CollationKeys generated by java.text.Collators are not compatible
* with those those generated by ICU Collators. Specifically, if you use
* CollationKeyAnalyzer to generate index terms, do not use
* ICUCollationKeyAnalyzer on the query side, or vice versa.
diff --git a/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyFilter.java b/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyFilter.java
index 6efc7a3434d..41aae62ab7d 100644
--- a/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyFilter.java
+++ b/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyFilter.java
@@ -57,12 +57,17 @@ import java.text.Collator;
* </li>
* </ol>
* <p>
- * NB 1: {@link ICUCollationKeyFilter} uses ICU4J's Collator, which makes its
+ * {@link ICUCollationKeyFilter} uses ICU4J's Collator, which makes its
* version available, thus allowing collation to be versioned independently
- * from the JVM.
+ * from the JVM. ICUCollationKeyFilter is also significantly faster and
+ * generates significantly shorter keys than CollationKeyFilter. See
+ * <a href="http://site.icu-project.org/charts/collation-icu4j-sun"
+ * >http://site.icu-project.org/charts/collation-icu4j-sun</a> for key
+ * generation timing and key length comparisons between ICU4J and
+ * java.text.Collator over several languages.
* </p>
* <p>
- * NB 2: CollationKeys generated by java.text.Collators are not compatible
+ * CollationKeys generated by java.text.Collators are not compatible
* with those those generated by ICU Collators. Specifically, if you use
* CollationKeyFilter to generate index terms, do not use
* {@link ICUCollationKeyFilter} on the query side, or vice versa.
diff --git a/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java b/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
index 637851b0667..4e4e1855b1d 100644
--- a/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
+++ b/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
@@ -55,11 +55,19 @@ import java.io.IOException;
* </li>
* </ol>
* <p>
- * NB: CollationKeys generated by ICU Collators are not compatible with those
+ * CollationKeys generated by ICU Collators are not compatible with those
* generated by java.text.Collators. Specifically, if you use
* ICUCollationKeyAnalyzer to generate index terms, do not use
* {@link CollationKeyAnalyzer} on the query side, or vice versa.
* </p>
+ * <p>
+ * ICUCollationKeyAnalyzer is significantly faster and generates significantly
+ * shorter keys than CollationKeyAnalyzer. See
+ * <a href="http://site.icu-project.org/charts/collation-icu4j-sun"
+ * >http://site.icu-project.org/charts/collation-icu4j-sun</a> for key
+ * generation timing and key length comparisons between ICU4J and
+ * java.text.Collator over several languages.
+ * </p>
*/
public class ICUCollationKeyAnalyzer extends Analyzer {
private Collator collator;
diff --git a/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyFilter.java b/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyFilter.java
index 596decd325f..27abe24c2e0 100644
--- a/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyFilter.java
+++ b/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyFilter.java
@@ -55,11 +55,19 @@ import java.nio.CharBuffer;
* </li>
* </ol>
* <p>
- * NB: CollationKeys generated by ICU Collators are not compatible with those
+ * CollationKeys generated by ICU Collators are not compatible with those
* generated by java.text.Collators. Specifically, if you use
* ICUCollationKeyFilter to generate index terms, do not use
* {@link CollationKeyFilter} on the query side, or vice versa.
* </p>
+ * <p>
+ * ICUCollationKeyFilter is significantly faster and generates significantly
+ * shorter keys than CollationKeyFilter. See
+ * <a href="http://site.icu-project.org/charts/collation-icu4j-sun"
+ * >http://site.icu-project.org/charts/collation-icu4j-sun</a> for key
+ * generation timing and key length comparisons between ICU4J and
+ * java.text.Collator over several languages.
+ * </p>
*/
public class ICUCollationKeyFilter extends TokenFilter {
private Collator collator = null;