Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

add an example showing how to control back compat

Robert Muirbc32989b047b
diff --git a/lucene/contrib/icu/src/java/overview.html b/lucene/contrib/icu/src/java/overview.html
index 313f1fb70f1..e96618ef9c3 100644
--- a/lucene/contrib/icu/src/java/overview.html
+++ b/lucene/contrib/icu/src/java/overview.html
@@ -285,5 +285,26 @@ many character foldings recursively.
*/
TokenStream tokenstream = new ICUFoldingFilter(tokenizer);
</pre></code>
+<hr/>
+<h1><a name="backcompat">Backwards Compatibility</a></h1>
+<p>
+This module exists to provide up-to-date Unicode functionality that supports
+the most recent version of Unicode (currently 5.2). However, some users who wish
+for stronger backwards compatibility can restrict
+{@link org.apache.lucene.analysis.icu.ICUNormalizer2Filter} to operate on only
+a specific Unicode Version by using a {@link com.ibm.icu.text.FilteredNormalizer2}.
+</p>
+<h2>Example Usages</h2>
+<h3>Restricting normalization to Unicode 5.0</h3>
+<code><pre>
+ /**
+ * This filter will do NFC normalization, but will ignore any characters that
+ * did not exist as of Unicode 5.0. Because of the normalization stability policy
+ * of Unicode, this is an easy way to force normalization to a specific version.
+ */
+ Normalizer2 normalizer = Normalizer2.getInstance(null, "nfc", Normalizer2.Mode.COMPOSE);
+ FilteredNormalizer2 unicode50 = new FilteredNormalizer2(normalizer, new UnicodeSet("[:age=5.0:]"));
+ TokenStream tokenstream = new ICUNormalizer2Filter(tokenizer, unicode50);
+</pre></code>
</body>
</html>