modify example to be more performant

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@936726 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-04-22 10:14:09 +00:00
parent bc32989b04
commit e48349b757
1 changed files with 4 additions and 1 deletions

View File

@ -303,7 +303,10 @@ a specific Unicode Version by using a {@link com.ibm.icu.text.FilteredNormalizer
* 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:]"));
UnicodeSet set = new UnicodeSet("[:age=5.0:]");
// see FilteredNormalizer2 docs, the set should be frozen or performance will suffer
set.freeze();
FilteredNormalizer2 unicode50 = new FilteredNormalizer2(normalizer, set);
TokenStream tokenstream = new ICUNormalizer2Filter(tokenizer, unicode50);
</pre></code>
</body>