Skip to content

Apache Lucene open-source search software

LUCENE-1435: add contrib/collation (CollationKeyFilter), to convert tokens into indexable CollationKeys

Michael McCandless6bf0e6e09bdd
diff --git a/build.xml b/build.xml
index 568c327f720..69fe0f8b545 100644
--- a/build.xml
+++ b/build.xml
@@ -288,6 +288,7 @@
<packageset dir="contrib/analyzers/src/java"/>
<packageset dir="contrib/ant/src/java"/>
<packageset dir="contrib/benchmark/src/java"/>
+ <packageset dir="contrib/collation/src/java"/>
<packageset dir="contrib/db/bdb-je/src/java"/>
<packageset dir="contrib/db/bdb/src/java"/>
<packageset dir="contrib/highlighter/src/java"/>
@@ -318,6 +319,7 @@
<group title="contrib: Analysis" packages="org.apache.lucene.analysis.*"/>
<group title="contrib: Ant" packages="org.apache.lucene.ant*"/>
<group title="contrib: Benchmark" packages="org.apache.lucene.benchmark*"/>
+ <group title="contrib: Collation" packages="org.apache.lucene.collation*"/>
<group title="contrib: DB" packages="org.apache.lucene.store.db*:org.apache.lucene.store.je*:com.sleepycat*"/>
<group title="contrib: Highlighter" packages="org.apache.lucene.search.highlight*"/>
<group title="contrib: Instantiated" packages="org.apache.lucene.store.instantiated*"/>
diff --git a/contrib/CHANGES.txt b/contrib/CHANGES.txt
index 91258f9cfd2..f4ea047a9ce 100644
--- a/contrib/CHANGES.txt
+++ b/contrib/CHANGES.txt
@@ -40,6 +40,12 @@ New features
2. LUCENE-1531: Added support for BoostingTermQuery to XML query parser. (Karl Wettin)
+ 3. LUCENE-1435: Added contrib/collation, a CollationKeyFilter
+ allowing you to convert tokens into CollationKeys encoded usign
+ IndexableBinaryStringTools. This allows for faster RangQuery when
+ a field needs to use a custom Collator. (Steven Rowe via Mike
+ McCandless)
+
Documentation
diff --git a/contrib/collation/build.xml b/contrib/collation/build.xml
new file mode 100644
index 00000000000..8664e54e37e
--- /dev/null
+++ b/contrib/collation/build.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<project name="collation" default="default">
+
+ <description>
+ CollationKeyFilter, ICUCollationKeyFilter, CollationKeyAnalyzer, and
+ ICUCollationKeyAnalyzer - converts tokens into indexable collation keys
+ </description>
+
+
+ <path id="additional.dependencies">
+ <fileset dir="lib" includes="icu4j-*.jar"/>
+ <pathelement location="../../build/contrib/misc/classes/java"/>
+ </path>
+
+ <pathconvert property="project.classpath"
+ targetos="unix"
+ refid="additional.dependencies"
+ />
+
+ <import file="../contrib-build.xml"/>
+
+ <target name="compile-misc">
+ <subant target="compile">
+ <fileset dir="${common.dir}/contrib/miscellaneous" includes="build.xml"/>
+ </subant>
+ </target>
+
+ <target name="init" depends="common.init,compile-misc"/>
+
+ <target name="compile" depends="init">
+ <antcall target="common.compile" inheritRefs="true" />
+ </target>
+
+</project>
diff --git a/contrib/collation/lib/ICU-LICENSE.txt b/contrib/collation/lib/ICU-LICENSE.txt
new file mode 100644
index 00000000000..6eab0423347
--- /dev/null
+++ b/contrib/collation/lib/ICU-LICENSE.txt
@@ -0,0 +1,33 @@
+ICU License - ICU 1.8.1 and later
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1995-2008 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+provided that the above copyright notice(s) and this permission notice appear
+in all copies of the Software and that both the above copyright notice(s) and
+this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
+LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization of the
+copyright holder.
+
+All trademarks and registered trademarks mentioned herein are the property of
+their respective owners.
diff --git a/contrib/collation/lib/icu4j-4_0.jar b/contrib/collation/lib/icu4j-4_0.jar
new file mode 100644
index 00000000000..d848373973e
--- /dev/null
+++ b/contrib/collation/lib/icu4j-4_0.jar
@@ -0,0 +1,2 @@
+AnyObjectId[5897f3452e3ba95bbc5b95cbf4fb1a99bccb1f59] was removed in git history.
+Apache SVN contains full history.
\ No newline at end of file
diff --git a/contrib/collation/pom.xml.template b/contrib/collation/pom.xml.template
new file mode 100644
index 00000000000..5f1b6621864
--- /dev/null
+++ b/contrib/collation/pom.xml.template
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-contrib</artifactId>
+ <version>@version@</version>
+ </parent>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-collation</artifactId>
+ <name>
+ Lucene CollationKeyFilter/Analyzer &amp; ICUCollationKeyFilter/Analyzer
+ </name>
+ <version>@version@</version>
+ <description>
+ CollationKeyFilter, ICUCollationKeyFilter, CollationKeyAnalyzer, and
+ ICUCollationKeyAnalyzer - converts tokens into indexable collation keys
+ </description>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>com.ibm.icu</groupId>
+ <artifactId>icu4j</artifactId>
+ <version>${icu-version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyAnalyzer.java b/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyAnalyzer.java
new file mode 100644
index 00000000000..bf622796a73
--- /dev/null
+++ b/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyAnalyzer.java
@@ -0,0 +1,105 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.KeywordTokenizer;
+import org.apache.lucene.analysis.Tokenizer;
+
+import java.text.Collator;
+import java.io.Reader;
+import java.io.IOException;
+
+/**
+ * <p>
+ * Filters {@link KeywordTokenizer} with {@link CollationKeyFilter}.
+ * </p>
+ * <p>
+ * Converts the token into its {@link java.text.CollationKey}, and then
+ * encodes the CollationKey with
+ * {@link org.apache.lucene.util.IndexableBinaryStringTools}, to allow
+ * it to be stored as an index term.
+ * </p>
+ * <p>
+ * <strong>WARNING:</strong> Make sure you use exactly the same Collator at
+ * index and query time -- CollationKeys are only comparable when produced by
+ * the same Collator. Since {@link java.text.RuleBasedCollator}s are not
+ * independently versioned, it is unsafe to search against stored
+ * CollationKeys unless the following are exactly the same (best practice is
+ * to store this information with the index and check that they remain the
+ * same at query time):
+ * </p>
+ * <ol>
+ * <li>JVM vendor</li>
+ * <li>JVM version, including patch version</li>
+ * <li>
+ * The language (and country and variant, if specified) of the Locale
+ * used when constructing the collator via
+ * {@link Collator#getInstance(java.util.Locale)}.
+ * </li>
+ * <li>
+ * The collation strength used - see {@link Collator#setStrength(int)}
+ * </li>
+ * </ol>
+ * <p>
+ * NB 1: {@link ICUCollationKeyAnalyzer} uses ICU4J's Collator, which makes
+ * its version available, thus allowing collation to be versioned
+ * independently from the JVM.
+ * </p>
+ * <p>
+ * NB 2: 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.
+ * </p>
+ */
+public class CollationKeyAnalyzer extends Analyzer {
+ private Collator collator;
+
+ CollationKeyAnalyzer(Collator collator) {
+ this.collator = collator;
+ }
+
+ public TokenStream tokenStream(String fieldName, Reader reader) {
+ TokenStream result = new KeywordTokenizer(reader);
+ result = new CollationKeyFilter(result, collator);
+ return result;
+ }
+
+ private class SavedStreams {
+ Tokenizer source;
+ TokenStream result;
+ }
+
+ public TokenStream reusableTokenStream(String fieldName, Reader reader)
+ throws IOException {
+
+ SavedStreams streams = (SavedStreams)getPreviousTokenStream();
+ if (streams == null) {
+ streams = new SavedStreams();
+ streams.source = new KeywordTokenizer(reader);
+ streams.result = new CollationKeyFilter(streams.source, collator);
+ setPreviousTokenStream(streams);
+ } else {
+ streams.source.reset(reader);
+ }
+ return streams.result;
+ }
+}
diff --git a/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyFilter.java b/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyFilter.java
new file mode 100644
index 00000000000..6efc7a3434d
--- /dev/null
+++ b/contrib/collation/src/java/org/apache/lucene/collation/CollationKeyFilter.java
@@ -0,0 +1,102 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import org.apache.lucene.analysis.TokenFilter;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.util.IndexableBinaryStringTools;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.text.Collator;
+
+
+/**
+ * <p>
+ * Converts each token into its {@link java.text.CollationKey}, and then
+ * encodes the CollationKey with {@link IndexableBinaryStringTools}, to allow
+ * it to be stored as an index term.
+ * </p>
+ * <p>
+ * <strong>WARNING:</strong> Make sure you use exactly the same Collator at
+ * index and query time -- CollationKeys are only comparable when produced by
+ * the same Collator. Since {@link java.text.RuleBasedCollator}s are not
+ * independently versioned, it is unsafe to search against stored
+ * CollationKeys unless the following are exactly the same (best practice is
+ * to store this information with the index and check that they remain the
+ * same at query time):
+ * </p>
+ * <ol>
+ * <li>JVM vendor</li>
+ * <li>JVM version, including patch version</li>
+ * <li>
+ * The language (and country and variant, if specified) of the Locale
+ * used when constructing the collator via
+ * {@link Collator#getInstance(java.util.Locale)}.
+ * </li>
+ * <li>
+ * The collation strength used - see {@link Collator#setStrength(int)}
+ * </li>
+ * </ol>
+ * <p>
+ * NB 1: {@link ICUCollationKeyFilter} uses ICU4J's Collator, which makes its
+ * version available, thus allowing collation to be versioned independently
+ * from the JVM.
+ * </p>
+ * <p>
+ * NB 2: 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.
+ * </p>
+ */
+public class CollationKeyFilter extends TokenFilter {
+ private Collator collator = null;
+
+ /**
+ * @param input Source token stream
+ * @param collator CollationKey generator
+ */
+ public CollationKeyFilter(TokenStream input, Collator collator) {
+ super(input);
+ this.collator = collator;
+ }
+
+ public final Token next(final Token reusableToken) throws IOException {
+ assert reusableToken != null;
+ Token nextToken = input.next(reusableToken);
+ if (nextToken != null) {
+ char[] termBuffer = nextToken.termBuffer();
+ String termText = new String(termBuffer, 0, nextToken.termLength());
+ byte[] collationKey = collator.getCollationKey(termText).toByteArray();
+ ByteBuffer collationKeyBuf = ByteBuffer.wrap(collationKey);
+ int encodedLength
+ = IndexableBinaryStringTools.getEncodedLength(collationKeyBuf);
+ if (encodedLength > termBuffer.length) {
+ nextToken.resizeTermBuffer(encodedLength);
+ }
+ nextToken.setTermLength(encodedLength);
+ CharBuffer wrappedTermBuffer = CharBuffer.wrap(nextToken.termBuffer());
+ IndexableBinaryStringTools.encode(collationKeyBuf, wrappedTermBuffer);
+ }
+ return nextToken;
+ }
+}
diff --git a/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java b/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
new file mode 100644
index 00000000000..637851b0667
--- /dev/null
+++ b/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
@@ -0,0 +1,96 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import com.ibm.icu.text.Collator;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.KeywordTokenizer;
+import org.apache.lucene.analysis.Tokenizer;
+
+import java.io.Reader;
+import java.io.IOException;
+
+
+/**
+ * <p>
+ * Filters {@link KeywordTokenizer} with {@link ICUCollationKeyFilter}.
+ * <p>
+ * Converts the token into its {@link com.ibm.icu.text.CollationKey}, and
+ * then encodes the CollationKey with
+ * {@link org.apache.lucene.util.IndexableBinaryStringTools}, to allow it to
+ * be stored as an index term.
+ * </p>
+ * <p>
+ * <strong>WARNING:</strong> Make sure you use exactly the same Collator at
+ * index and query time -- CollationKeys are only comparable when produced by
+ * the same Collator. {@link com.ibm.icu.text.RuleBasedCollator}s are
+ * independently versioned, so it is safe to search against stored
+ * CollationKeys if the following are exactly the same (best practice is
+ * to store this information with the index and check that they remain the
+ * same at query time):
+ * </p>
+ * <ol>
+ * <li>
+ * Collator version - see {@link Collator#getVersion()}
+ * </li>
+ * <li>
+ * The collation strength used - see {@link Collator#setStrength(int)}
+ * </li>
+ * </ol>
+ * <p>
+ * NB: 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>
+ */
+public class ICUCollationKeyAnalyzer extends Analyzer {
+ private Collator collator;
+
+ ICUCollationKeyAnalyzer(Collator collator) {
+ this.collator = collator;
+ }
+
+ public TokenStream tokenStream(String fieldName, Reader reader) {
+ TokenStream result = new KeywordTokenizer(reader);
+ result = new ICUCollationKeyFilter(result, collator);
+ return result;
+ }
+
+ private class SavedStreams {
+ Tokenizer source;
+ TokenStream result;
+ }
+
+ public TokenStream reusableTokenStream(String fieldName, Reader reader)
+ throws IOException {
+
+ SavedStreams streams = (SavedStreams)getPreviousTokenStream();
+ if (streams == null) {
+ streams = new SavedStreams();
+ streams.source = new KeywordTokenizer(reader);
+ streams.result = new ICUCollationKeyFilter(streams.source, collator);
+ setPreviousTokenStream(streams);
+ } else {
+ streams.source.reset(reader);
+ }
+ return streams.result;
+ }
+}
diff --git a/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyFilter.java b/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyFilter.java
new file mode 100644
index 00000000000..aadcb4b1252
--- /dev/null
+++ b/contrib/collation/src/java/org/apache/lucene/collation/ICUCollationKeyFilter.java
@@ -0,0 +1,94 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import com.ibm.icu.text.Collator;
+import org.apache.lucene.analysis.TokenFilter;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.util.IndexableBinaryStringTools;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+
+
+/**
+ * <p>
+ * Converts each token into its {@link com.ibm.icu.text.CollationKey}, and
+ * then encodes the CollationKey with {@link IndexableBinaryStringTools}, to
+ * allow it to be stored as an index term.
+ * </p>
+ * <p>
+ * <strong>WARNING:</strong> Make sure you use exactly the same Collator at
+ * index and query time -- CollationKeys are only comparable when produced by
+ * the same Collator. {@link com.ibm.icu.text.RuleBasedCollator}s are
+ * independently versioned, so it is safe to search against stored
+ * CollationKeys if the following are exactly the same (best practice is
+ * to store this information with the index and check that they remain the
+ * same at query time):
+ * </p>
+ * <ol>
+ * <li>
+ * Collator version - see {@link Collator#getVersion()}
+ * </li>
+ * <li>
+ * The collation strength used - see {@link Collator#setStrength(int)}
+ * </li>
+ * </ol>
+ * <p>
+ * NB: 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>
+ */
+public class ICUCollationKeyFilter extends TokenFilter {
+ private Collator collator = null;
+
+ /**
+ *
+ * @param input Source token stream
+ * @param collator CollationKey generator
+ */
+ public ICUCollationKeyFilter(TokenStream input, Collator collator) {
+ super(input);
+ this.collator = collator;
+ }
+
+ public final Token next(final Token reusableToken) throws IOException {
+ assert reusableToken != null;
+ Token nextToken = input.next(reusableToken);
+ if (nextToken != null) {
+ char[] termBuffer = nextToken.termBuffer();
+ String termText = new String(termBuffer, 0, nextToken.termLength());
+ byte[] collationKey = collator.getCollationKey(termText).toByteArray();
+ ByteBuffer collationKeyBuf = ByteBuffer.wrap(collationKey);
+ int encodedLength
+ = IndexableBinaryStringTools.getEncodedLength(collationKeyBuf);
+ if (encodedLength > termBuffer.length) {
+ nextToken.resizeTermBuffer(encodedLength);
+ }
+ nextToken.setTermLength(encodedLength);
+ CharBuffer wrappedTermBuffer = CharBuffer.wrap(nextToken.termBuffer());
+ IndexableBinaryStringTools.encode(collationKeyBuf, wrappedTermBuffer);
+ }
+ return nextToken;
+ }
+}
diff --git a/contrib/collation/src/java/overview.html b/contrib/collation/src/java/overview.html
new file mode 100644
index 00000000000..0c949bc742b
--- /dev/null
+++ b/contrib/collation/src/java/overview.html
@@ -0,0 +1,10 @@
+<html>
+ <head>
+ <title>
+ Apache Lucene CollationKeyFilter/Analyzer and
+ ICUCollationKeyFilter/Analyzer
+ </title>
+ </head>
+ <body>
+ </body>
+</html>
\ No newline at end of file
diff --git a/contrib/collation/src/test/org/apache/lucene/collation/CollationTestBase.java b/contrib/collation/src/test/org/apache/lucene/collation/CollationTestBase.java
new file mode 100644
index 00000000000..b0044a82078
--- /dev/null
+++ b/contrib/collation/src/test/org/apache/lucene/collation/CollationTestBase.java
@@ -0,0 +1,308 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import junit.framework.TestCase;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.PerFieldAnalyzerWrapper;
+import org.apache.lucene.analysis.WhitespaceAnalyzer;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.RangeFilter;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.search.RangeQuery;
+import org.apache.lucene.search.ConstantScoreRangeQuery;
+import org.apache.lucene.search.Searcher;
+import org.apache.lucene.search.Sort;
+import org.apache.lucene.search.SortField;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.util.IndexableBinaryStringTools;
+import org.apache.lucene.queryParser.analyzing.AnalyzingQueryParser;
+
+import java.io.IOException;
+import java.nio.CharBuffer;
+import java.nio.ByteBuffer;
+
+
+public class CollationTestBase extends TestCase {
+
+ protected String firstRangeBeginningOriginal = "\u062F";
+ protected String firstRangeEndOriginal = "\u0698";
+
+ protected String secondRangeBeginningOriginal = "\u0633";
+ protected String secondRangeEndOriginal = "\u0638";
+
+ /**
+ * Convenience method to perform the same function as CollationKeyFilter.
+ *
+ * @param keyBits the result from
+ * collator.getCollationKey(original).toByteArray()
+ * @return The encoded collation key for the original String
+ */
+ protected String encodeCollationKey(byte[] keyBits) {
+ ByteBuffer begBuf = ByteBuffer.wrap(keyBits);
+ // Ensure that the backing char[] array is large enough to hold the encoded
+ // Binary String
+ char[] encodedBegArray
+ = new char[IndexableBinaryStringTools.getEncodedLength(begBuf)];
+ CharBuffer encodedBegBuf = CharBuffer.wrap(encodedBegArray);
+ IndexableBinaryStringTools.encode(begBuf, encodedBegBuf);
+ return new String(encodedBegArray);
+ }
+
+ public void testFarsiQueryParserCollating(Analyzer analyzer) throws Exception {
+
+ RAMDirectory ramDir = new RAMDirectory();
+ IndexWriter writer = new IndexWriter
+ (ramDir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+ Document doc = new Document();
+ doc.add(new Field("content", "\u0633\u0627\u0628",
+ Field.Store.YES, Field.Index.ANALYZED));
+ writer.addDocument(doc);
+ writer.close();
+ IndexSearcher is = new IndexSearcher(ramDir);
+
+ AnalyzingQueryParser aqp = new AnalyzingQueryParser("content", analyzer);
+ aqp.setLowercaseExpandedTerms(false);
+
+ // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
+ // orders the U+0698 character before the U+0633 character, so the single
+ // index Term below should NOT be returned by a ConstantScoreRangeQuery
+ // with a Farsi Collator (or an Arabic one for the case when Farsi is not
+ // supported).
+
+ // Test ConstantScoreRangeQuery
+ aqp.setUseOldRangeQuery(false);
+ ScoreDoc[] result
+ = is.search(aqp.parse("[ \u062F TO \u0698 ]"), null, 1000).scoreDocs;
+ assertEquals("The index Term should not be included.", 0, result.length);
+
+ result = is.search(aqp.parse("[ \u0633 TO \u0638 ]"), null, 1000).scoreDocs;
+ assertEquals("The index Term should be included.", 1, result.length);
+
+ // Test RangeQuery
+ aqp.setUseOldRangeQuery(true);
+ result = is.search(aqp.parse("[ \u062F TO \u0698 ]"), null, 1000).scoreDocs;
+ assertEquals("The index Term should not be included.", 0, result.length);
+
+ result = is.search(aqp.parse("[ \u0633 TO \u0638 ]"), null, 1000).scoreDocs;
+ assertEquals("The index Term should be included.", 1, result.length);
+
+ is.close();
+ }
+
+
+ public void testFarsiRangeFilterCollating(Analyzer analyzer, String firstBeg,
+ String firstEnd, String secondBeg,
+ String secondEnd) throws Exception {
+ RAMDirectory ramDir = new RAMDirectory();
+ IndexWriter writer = new IndexWriter
+ (ramDir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+ Document doc = new Document();
+ doc.add(new Field("content", "\u0633\u0627\u0628",
+ Field.Store.YES, Field.Index.ANALYZED));
+ doc.add(new Field("body", "body",
+ Field.Store.YES, Field.Index.NOT_ANALYZED));
+ writer.addDocument(doc);
+ writer.close();
+ IndexSearcher searcher = new IndexSearcher(ramDir);
+ Query query = new TermQuery(new Term("body","body"));
+
+ // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
+ // orders the U+0698 character before the U+0633 character, so the single
+ // index Term below should NOT be returned by a RangeFilter with a Farsi
+ // Collator (or an Arabic one for the case when Farsi searcher not
+ // supported).
+ ScoreDoc[] result = searcher.search
+ (query, new RangeFilter("content", firstBeg, firstEnd, true, true), 1).scoreDocs;
+ assertEquals("The index Term should not be included.", 0, result.length);
+
+ result = searcher.search
+ (query, new RangeFilter("content", secondBeg, secondEnd, true, true), 1).scoreDocs;
+ assertEquals("The index Term should be included.", 1, result.length);
+
+ searcher.close();
+ }
+
+ public void testFarsiRangeQueryCollating(Analyzer analyzer, String firstBeg,
+ String firstEnd, String secondBeg,
+ String secondEnd) throws Exception {
+ RAMDirectory ramDir = new RAMDirectory();
+ IndexWriter writer = new IndexWriter
+ (ramDir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+ Document doc = new Document();
+
+ // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
+ // orders the U+0698 character before the U+0633 character, so the single
+ // index Term below should NOT be returned by a RangeQuery with a Farsi
+ // Collator (or an Arabic one for the case when Farsi is not supported).
+ doc.add(new Field("content", "\u0633\u0627\u0628",
+ Field.Store.YES, Field.Index.ANALYZED));
+ writer.addDocument(doc);
+ writer.close();
+ IndexSearcher searcher = new IndexSearcher(ramDir);
+
+ Query query = new RangeQuery(new Term("content", firstBeg),
+ new Term("content", firstEnd), true);
+ ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
+ assertEquals("The index Term should not be included.", 0, hits.length);
+
+ query = new RangeQuery(new Term("content", secondBeg),
+ new Term("content", secondEnd), true);
+ hits = searcher.search(query, null, 1000).scoreDocs;
+ assertEquals("The index Term should be included.", 1, hits.length);
+ searcher.close();
+ }
+
+ public void testFarsiConstantScoreRangeQuery
+ (Analyzer analyzer, String firstBeg, String firstEnd,
+ String secondBeg, String secondEnd) throws Exception {
+
+ RAMDirectory farsiIndex = new RAMDirectory();
+ IndexWriter writer = new IndexWriter
+ (farsiIndex, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+ Document doc = new Document();
+ doc.add(new Field("content", "\u0633\u0627\u0628",
+ Field.Store.YES, Field.Index.ANALYZED));
+ doc.add(new Field("body", "body",
+ Field.Store.YES, Field.Index.NOT_ANALYZED));
+ writer.addDocument(doc);
+ writer.close();
+
+ IndexReader reader = IndexReader.open(farsiIndex);
+ IndexSearcher search = new IndexSearcher(reader);
+
+ // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
+ // orders the U+0698 character before the U+0633 character, so the single
+ // index Term below should NOT be returned by a ConstantScoreRangeQuery
+ // with a Farsi Collator (or an Arabic one for the case when Farsi is
+ // not supported).
+ Query csrq
+ = new ConstantScoreRangeQuery("content", firstBeg, firstEnd, true, true);
+ ScoreDoc[] result = search.search(csrq, null, 1000).scoreDocs;
+ assertEquals("The index Term should not be included.", 0, result.length);
+
+ csrq = new ConstantScoreRangeQuery
+ ("content", secondBeg, secondEnd, true, true);
+ result = search.search(csrq, null, 1000).scoreDocs;
+ assertEquals("The index Term should be included.", 1, result.length);
+ search.close();
+ }
+
+ // Test using various international locales with accented characters (which
+ // sort differently depending on locale)
+ //
+ // Copied (and slightly modified) from
+ // org.apache.lucene.search.TestSort.testInternationalSort()
+ //
+ public void testCollationKeySort(Analyzer usAnalyzer,
+ Analyzer franceAnalyzer,
+ Analyzer swedenAnalyzer,
+ Analyzer denmarkAnalyzer,
+ String usResult) throws Exception {
+ RAMDirectory indexStore = new RAMDirectory();
+ PerFieldAnalyzerWrapper analyzer
+ = new PerFieldAnalyzerWrapper(new WhitespaceAnalyzer());
+ analyzer.addAnalyzer("US", usAnalyzer);
+ analyzer.addAnalyzer("France", franceAnalyzer);
+ analyzer.addAnalyzer("Sweden", swedenAnalyzer);
+ analyzer.addAnalyzer("Denmark", denmarkAnalyzer);
+ IndexWriter writer = new IndexWriter
+ (indexStore, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
+
+ // document data:
+ // the tracer field is used to determine which document was hit
+ String[][] sortData = new String[][] {
+ // tracer contents US France Sweden (sv_SE) Denmark (da_DK)
+ { "A", "x", "p\u00EAche", "p\u00EAche", "p\u00EAche", "p\u00EAche" },
+ { "B", "y", "HAT", "HAT", "HAT", "HAT" },
+ { "C", "x", "p\u00E9ch\u00E9", "p\u00E9ch\u00E9", "p\u00E9ch\u00E9", "p\u00E9ch\u00E9" },
+ { "D", "y", "HUT", "HUT", "HUT", "HUT" },
+ { "E", "x", "peach", "peach", "peach", "peach" },
+ { "F", "y", "H\u00C5T", "H\u00C5T", "H\u00C5T", "H\u00C5T" },
+ { "G", "x", "sin", "sin", "sin", "sin" },
+ { "H", "y", "H\u00D8T", "H\u00D8T", "H\u00D8T", "H\u00D8T" },
+ { "I", "x", "s\u00EDn", "s\u00EDn", "s\u00EDn", "s\u00EDn" },
+ { "J", "y", "HOT", "HOT", "HOT", "HOT" },
+ };
+
+ for (int i = 0 ; i < sortData.length ; ++i) {
+ Document doc = new Document();
+ doc.add(new Field("tracer", sortData[i][0],
+ Field.Store.YES, Field.Index.NO));
+ doc.add(new Field("contents", sortData[i][1],
+ Field.Store.NO, Field.Index.ANALYZED));
+ if (sortData[i][2] != null)
+ doc.add(new Field("US", sortData[i][2],
+ Field.Store.NO, Field.Index.ANALYZED));
+ if (sortData[i][3] != null)
+ doc.add(new Field("France", sortData[i][3],
+ Field.Store.NO, Field.Index.ANALYZED));
+ if (sortData[i][4] != null)
+ doc.add(new Field("Sweden", sortData[i][4],
+ Field.Store.NO, Field.Index.ANALYZED));
+ if (sortData[i][5] != null)
+ doc.add(new Field("Denmark", sortData[i][5],
+ Field.Store.NO, Field.Index.ANALYZED));
+ writer.addDocument(doc);
+ }
+ writer.optimize();
+ writer.close();
+ Searcher searcher = new IndexSearcher(indexStore);
+
+ Sort sort = new Sort();
+ Query queryX = new TermQuery(new Term ("contents", "x"));
+ Query queryY = new TermQuery(new Term ("contents", "y"));
+
+ sort.setSort(new SortField("US", SortField.STRING));
+ assertMatches(searcher, queryY, sort, usResult);
+
+ sort.setSort(new SortField("France", SortField.STRING));
+ assertMatches(searcher, queryX, sort, "EACGI");
+
+ sort.setSort(new SortField("Sweden", SortField.STRING));
+ assertMatches(searcher, queryY, sort, "BJDFH");
+
+ sort.setSort(new SortField("Denmark", SortField.STRING));
+ assertMatches(searcher, queryY, sort, "BJDHF");
+ }
+
+ // Make sure the documents returned by the search match the expected list
+ // Copied from TestSort.java
+ private void assertMatches(Searcher searcher, Query query, Sort sort,
+ String expectedResult) throws IOException {
+ ScoreDoc[] result = searcher.search(query, null, 1000, sort).scoreDocs;
+ StringBuffer buff = new StringBuffer(10);
+ int n = result.length;
+ for (int i = 0 ; i < n ; ++i) {
+ Document doc = searcher.doc(result[i].doc);
+ String[] v = doc.getValues("tracer");
+ for (int j = 0 ; j < v.length ; ++j) {
+ buff.append(v[j]);
+ }
+ }
+ assertEquals(expectedResult, buff.toString());
+ }
+}
diff --git a/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java b/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java
new file mode 100644
index 00000000000..fbec34b49a2
--- /dev/null
+++ b/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java
@@ -0,0 +1,82 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import org.apache.lucene.analysis.Analyzer;
+
+import java.text.Collator;
+import java.util.Locale;
+
+
+public class TestCollationKeyAnalyzer extends CollationTestBase {
+
+ // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
+ // RuleBasedCollator. However, the Arabic Locale seems to order the Farsi
+ // characters properly.
+ private Collator collator = Collator.getInstance(new Locale("ar"));
+ private Analyzer analyzer = new CollationKeyAnalyzer(collator);
+
+ private String firstRangeBeginning = encodeCollationKey
+ (collator.getCollationKey(firstRangeBeginningOriginal).toByteArray());
+ private String firstRangeEnd = encodeCollationKey
+ (collator.getCollationKey(firstRangeEndOriginal).toByteArray());
+ private String secondRangeBeginning = encodeCollationKey
+ (collator.getCollationKey(secondRangeBeginningOriginal).toByteArray());
+ private String secondRangeEnd = encodeCollationKey
+ (collator.getCollationKey(secondRangeEndOriginal).toByteArray());
+
+
+ public void testFarsiQueryParserCollating() throws Exception {
+ testFarsiQueryParserCollating(analyzer);
+ }
+
+ public void testFarsiRangeFilterCollating() throws Exception {
+ testFarsiRangeFilterCollating
+ (analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testFarsiRangeQueryCollating() throws Exception {
+ testFarsiRangeQueryCollating
+ (analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testFarsiConstantScoreRangeQuery() throws Exception {
+ testFarsiConstantScoreRangeQuery
+ (analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testCollationKeySort() throws Exception {
+ Analyzer usAnalyzer
+ = new CollationKeyAnalyzer(Collator.getInstance(Locale.US));
+ Analyzer franceAnalyzer
+ = new CollationKeyAnalyzer(Collator.getInstance(Locale.FRANCE));
+ Analyzer swedenAnalyzer
+ = new CollationKeyAnalyzer(Collator.getInstance(new Locale("sv", "se")));
+ Analyzer denmarkAnalyzer
+ = new CollationKeyAnalyzer(Collator.getInstance(new Locale("da", "dk")));
+
+ // The ICU Collator and java.text.Collator implementations differ in their
+ // orderings - "BFJDH" is the ordering for java.text.Collator for Locale.US.
+ testCollationKeySort
+ (usAnalyzer, franceAnalyzer, swedenAnalyzer, denmarkAnalyzer, "BFJDH");
+ }
+}
diff --git a/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyFilter.java b/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyFilter.java
new file mode 100644
index 00000000000..3e9eb56dafb
--- /dev/null
+++ b/contrib/collation/src/test/org/apache/lucene/collation/TestCollationKeyFilter.java
@@ -0,0 +1,99 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.KeywordTokenizer;
+
+import java.text.Collator;
+import java.util.Locale;
+import java.io.Reader;
+
+
+public class TestCollationKeyFilter extends CollationTestBase {
+
+ // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
+ // RuleBasedCollator. However, the Arabic Locale seems to order the Farsi
+ // characters properly.
+ private Collator collator = Collator.getInstance(new Locale("ar"));
+ private Analyzer analyzer = new TestAnalyzer(collator);
+
+ private String firstRangeBeginning = encodeCollationKey
+ (collator.getCollationKey(firstRangeBeginningOriginal).toByteArray());
+ private String firstRangeEnd = encodeCollationKey
+ (collator.getCollationKey(firstRangeEndOriginal).toByteArray());
+ private String secondRangeBeginning = encodeCollationKey
+ (collator.getCollationKey(secondRangeBeginningOriginal).toByteArray());
+ private String secondRangeEnd = encodeCollationKey
+ (collator.getCollationKey(secondRangeEndOriginal).toByteArray());
+
+
+ public class TestAnalyzer extends Analyzer {
+ private Collator collator;
+
+ TestAnalyzer(Collator collator) {
+ this.collator = collator;
+ }
+
+ public TokenStream tokenStream(String fieldName, Reader reader) {
+ TokenStream result = new KeywordTokenizer(reader);
+ result = new CollationKeyFilter(result, collator);
+ return result;
+ }
+ }
+
+ public void testFarsiQueryParserCollating() throws Exception {
+ testFarsiQueryParserCollating(analyzer);
+ }
+
+
+ public void testFarsiRangeFilterCollating() throws Exception {
+ testFarsiRangeFilterCollating
+ (analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testFarsiRangeQueryCollating() throws Exception {
+ testFarsiRangeQueryCollating
+ (analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testFarsiConstantScoreRangeQuery() throws Exception {
+ testFarsiConstantScoreRangeQuery
+ (analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testCollationKeySort() throws Exception {
+ Analyzer usAnalyzer = new TestAnalyzer(Collator.getInstance(Locale.US));
+ Analyzer franceAnalyzer
+ = new TestAnalyzer(Collator.getInstance(Locale.FRANCE));
+ Analyzer swedenAnalyzer
+ = new TestAnalyzer(Collator.getInstance(new Locale("sv", "se")));
+ Analyzer denmarkAnalyzer
+ = new TestAnalyzer(Collator.getInstance(new Locale("da", "dk")));
+
+ // The ICU Collator and java.text.Collator implementations differ in their
+ // orderings - "BFJDH" is the ordering for java.text.Collator for Locale.US.
+ testCollationKeySort
+ (usAnalyzer, franceAnalyzer, swedenAnalyzer, denmarkAnalyzer, "BFJDH");
+ }
+}
diff --git a/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java b/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java
new file mode 100644
index 00000000000..5ad4991d39f
--- /dev/null
+++ b/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java
@@ -0,0 +1,83 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import com.ibm.icu.text.Collator;
+import org.apache.lucene.analysis.Analyzer;
+
+import java.util.Locale;
+
+
+public class TestICUCollationKeyAnalyzer extends CollationTestBase {
+
+ private Collator collator = Collator.getInstance(new Locale("fa"));
+ private Analyzer analyzer = new ICUCollationKeyAnalyzer(collator);
+
+ private String firstRangeBeginning = encodeCollationKey
+ (collator.getCollationKey(firstRangeBeginningOriginal).toByteArray());
+ private String firstRangeEnd = encodeCollationKey
+ (collator.getCollationKey(firstRangeEndOriginal).toByteArray());
+ private String secondRangeBeginning = encodeCollationKey
+ (collator.getCollationKey(secondRangeBeginningOriginal).toByteArray());
+ private String secondRangeEnd = encodeCollationKey
+ (collator.getCollationKey(secondRangeEndOriginal).toByteArray());
+
+
+ public void testFarsiQueryParserCollating() throws Exception {
+ testFarsiQueryParserCollating(analyzer);
+ }
+
+ public void testFarsiRangeFilterCollating() throws Exception {
+ testFarsiRangeFilterCollating(analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testFarsiRangeQueryCollating() throws Exception {
+ testFarsiRangeQueryCollating(analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testFarsiConstantScoreRangeQuery() throws Exception {
+ testFarsiConstantScoreRangeQuery
+ (analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ // Test using various international locales with accented characters (which
+ // sort differently depending on locale)
+ //
+ // Copied (and slightly modified) from
+ // org.apache.lucene.search.TestSort.testInternationalSort()
+ //
+ public void testCollationKeySort() throws Exception {
+ Analyzer usAnalyzer = new ICUCollationKeyAnalyzer
+ (Collator.getInstance(Locale.US));
+ Analyzer franceAnalyzer = new ICUCollationKeyAnalyzer
+ (Collator.getInstance(Locale.FRANCE));
+ Analyzer swedenAnalyzer = new ICUCollationKeyAnalyzer
+ (Collator.getInstance(new Locale("sv", "se")));
+ Analyzer denmarkAnalyzer = new ICUCollationKeyAnalyzer
+ (Collator.getInstance(new Locale("da", "dk")));
+
+ // The ICU Collator and java.text.Collator implementations differ in their
+ // orderings - "BFJHD" is the ordering for the ICU Collator for Locale.US.
+ testCollationKeySort
+ (usAnalyzer, franceAnalyzer, swedenAnalyzer, denmarkAnalyzer, "BFJHD");
+ }
+}
diff --git a/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java b/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java
new file mode 100644
index 00000000000..fc5c71e1fc3
--- /dev/null
+++ b/contrib/collation/src/test/org/apache/lucene/collation/TestICUCollationKeyFilter.java
@@ -0,0 +1,100 @@
+package org.apache.lucene.collation;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import com.ibm.icu.text.Collator;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.KeywordTokenizer;
+
+import java.io.Reader;
+import java.util.Locale;
+
+
+public class TestICUCollationKeyFilter extends CollationTestBase {
+
+ private Collator collator = Collator.getInstance(new Locale("fa"));
+ private Analyzer analyzer = new TestAnalyzer(collator);
+
+ private String firstRangeBeginning = encodeCollationKey
+ (collator.getCollationKey(firstRangeBeginningOriginal).toByteArray());
+ private String firstRangeEnd = encodeCollationKey
+ (collator.getCollationKey(firstRangeEndOriginal).toByteArray());
+ private String secondRangeBeginning = encodeCollationKey
+ (collator.getCollationKey(secondRangeBeginningOriginal).toByteArray());
+ private String secondRangeEnd = encodeCollationKey
+ (collator.getCollationKey(secondRangeEndOriginal).toByteArray());
+
+
+ public class TestAnalyzer extends Analyzer {
+ private Collator collator;
+
+ TestAnalyzer(Collator collator) {
+ this.collator = collator;
+ }
+
+ public TokenStream tokenStream(String fieldName, Reader reader) {
+ TokenStream result = new KeywordTokenizer(reader);
+ result = new ICUCollationKeyFilter(result, collator);
+ return result;
+ }
+ }
+
+ public void testFarsiQueryParserCollating() throws Exception {
+ testFarsiQueryParserCollating(analyzer);
+ }
+
+
+ public void testFarsiRangeFilterCollating() throws Exception {
+ testFarsiRangeFilterCollating(analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testFarsiRangeQueryCollating() throws Exception {
+ testFarsiRangeQueryCollating(analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ public void testFarsiConstantScoreRangeQuery() throws Exception {
+ testFarsiConstantScoreRangeQuery
+ (analyzer, firstRangeBeginning, firstRangeEnd,
+ secondRangeBeginning, secondRangeEnd);
+ }
+
+ // Test using various international locales with accented characters (which
+ // sort differently depending on locale)
+ //
+ // Copied (and slightly modified) from
+ // org.apache.lucene.search.TestSort.testInternationalSort()
+ //
+ public void testCollationKeySort() throws Exception {
+ Analyzer usAnalyzer = new TestAnalyzer(Collator.getInstance(Locale.US));
+ Analyzer franceAnalyzer
+ = new TestAnalyzer(Collator.getInstance(Locale.FRANCE));
+ Analyzer swedenAnalyzer
+ = new TestAnalyzer(Collator.getInstance(new Locale("sv", "se")));
+ Analyzer denmarkAnalyzer
+ = new TestAnalyzer(Collator.getInstance(new Locale("da", "dk")));
+
+ // The ICU Collator and java.text.Collator implementations differ in their
+ // orderings - "BFJHD" is the ordering for the ICU Collator for Locale.US.
+ testCollationKeySort
+ (usAnalyzer, franceAnalyzer, swedenAnalyzer, denmarkAnalyzer, "BFJHD");
+ }
+}
diff --git a/docs/benchmarks.html b/docs/benchmarks.html
index a6307e2efdb..d10353b3d73 100644
--- a/docs/benchmarks.html
+++ b/docs/benchmarks.html
@@ -137,6 +137,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/contributions.html b/docs/contributions.html
index c26f0e7835e..6f6ea2f6fed 100644
--- a/docs/contributions.html
+++ b/docs/contributions.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/demo.html b/docs/demo.html
index ed76327cab6..4ff56efc12f 100644
--- a/docs/demo.html
+++ b/docs/demo.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/demo2.html b/docs/demo2.html
index f6e9e07c539..791565c7f50 100644
--- a/docs/demo2.html
+++ b/docs/demo2.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/demo3.html b/docs/demo3.html
index 3689d605c6f..6143c501602 100644
--- a/docs/demo3.html
+++ b/docs/demo3.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/demo4.html b/docs/demo4.html
index 2a8b32c374e..cd07d096300 100644
--- a/docs/demo4.html
+++ b/docs/demo4.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/fileformats.html b/docs/fileformats.html
index 4094aa8df14..c6ce2198bb8 100644
--- a/docs/fileformats.html
+++ b/docs/fileformats.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/gettingstarted.html b/docs/gettingstarted.html
index 02c5f714944..e133dbada5b 100644
--- a/docs/gettingstarted.html
+++ b/docs/gettingstarted.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/index.html b/docs/index.html
index 751cd9ea878..16ad8f9958a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -137,6 +137,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/linkmap.html b/docs/linkmap.html
index e1022e07b1e..b4a8e40bbc0 100644
--- a/docs/linkmap.html
+++ b/docs/linkmap.html
@@ -137,6 +137,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
@@ -311,6 +314,12 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>javadoc-contrib-benchmark</em>
</li>
</ul>
+
+<ul>
+<li>
+<a href="api/contrib-collation/index.html">Collation</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>javadoc-contrib-collation</em>
+</li>
+</ul>
<ul>
<li>
diff --git a/docs/linkmap.pdf b/docs/linkmap.pdf
index 8015ef08576..a81597e2e6c 100644
--- a/docs/linkmap.pdf
+++ b/docs/linkmap.pdf
@@ -5,10 +5,10 @@
/Producer (FOP 0.20.5) >>
endobj
5 0 obj
-<< /Length 1112 /Filter [ /ASCII85Decode /FlateDecode ]
+<< /Length 1117 /Filter [ /ASCII85Decode /FlateDecode ]
>>
stream
-GatUt9i'Lt(kD)R'fj.)T"gI/.3$tPe$QNl0hlP#BHU#AP/>kTT:N?KS^(=m+A2"!n+53%)h6'IP7L_?_A'e!EArIF?T*J_r<,PcrLt^jFdtc`GS2SddEf.EhTGG'MW7+\3P3DVa,S^]'aq8tN;M/]E.(lSXXr5h4SfdEXqd?n#kqj;a5RqT8:0-$SMrS4ds'*]CGB)^%JiDPm'#0O*"#iVfbUkNC7<p/M/m0h=p*<^oe($([00!DjD\`\8<^aa/]R.:`Zh@nKlIC^TsZhk9U8k=_%-D?o]I'QT*3(p"U&g,AD]kc"Qim>,(QA`4[l;fr5U;AD:EV?D-iL$C4m4]VUu*TWpHk(J@Mai=FE6[^-0[93L;D8<fHYkAhpAr:nJWD+E<cSMeCEr0=8LDUVo(MTo]#8=/nb)9urD\,Hm$"#k+i3&Ami(H`*jiEID/`%`<>JF]m82_k(hEqC8c1+2kH;Yg87`p[FN=.bH:A]pTc<@(,>%qoj/.3r?!pl[0R&QN/(:)_lHh5.8oN'0U,-aIP>1;2XB+YH3A?5aub^fT;6S<"'J%.nO2o?Bf;G5GifJr7&"Eg[W4M*OAc@;qAiWKsedYrK\u6PLaXt=,n]DksKFh;?R$`e0b)`Ys\:;$$>=Q9U=@X,O3<W;*snJfj^Ir%M584C:5X853M\+6N+<tI[@.E2)/Uq[E7t6iY4E%k=aL8C67VQQ)jWblQq/%)%5UCaCcK&B1f.g<fmWf_S0q?^f\#.#sLke"EC9g=#E@pYMj2\G*@tU(e\c?#bRsmFBRa#-At3TZJ(#IlD[rl?tt<hA/34iMPr>5^@,U'bA^%K(E,2?m.bZfGVi:?SD!O%hTJ.B@oH+fgl=UbXF#In1$6dRR?uII;M6\M.43k[dUJ.mRj5jaWg9Nb,arZ%i69b-H[O/O<:B*gb_`F?nHkDtR8<E[?!"Wnr&q&<1O;*i(ala^8/LI<@e/%9qn#QRJh`'a6ouIr0T0Z`h+bUZB)9.?X8?:S?BF*41?5kE0a:P$U6GWnpZ0M4qc`;7AiL(+`=*2%$m@RT&(\bb_8TGcApI_=[4e74C9DY'\t(9(^=J:eIA(.07ThWaIj\<*B_jr'Xt3u~>
+GatUt?#Q2d'Sc)J/%BCKiqXP'CpI&FeS=B4]60PJE>i!^.?J`/YFc7qYfU-C:918E.-H#+HsUVOR?'O;P5nM]KDB6be\?2/K?"Q2T_q5EXSOo1JFFtSDh=StZ`Fb*_&.ri]Q8(^(!i@[gNUl*7BYH"=8hg!//hABok!VCR,:GG(*MB])fdJ<!Je%GS$0/%Kja2kKmoTbQ[==ed7JN5c!'b![+oJ=d:b[cVRM^tW@9]n<8CNc[+SF\*8-I.S])_3p?W;,ZO[7uTLoUP&CA=.Dg/0/'G?&#nF+hu@mGJU&G$_M`6FD")!qm%.gV"4L'I>gTl0@lbB14Uo9M49=nn^'8jFA+;eT=2*u+n;We4aUBgMXq.]V)o]QmF1dNqT=.$$Z"A.XC76?\R*-Je0=o-L:IRhAM&b`B8C<DbRs]mg5k=*a5+X:Pr[c1$(WEMDI(\2`m!EkjOa/+9bkSB5#)B)Da5g'2__;._J2YpmB.6I_.^nIK0R2R&*5g!cCrU8bGP5?n>9LeW^iD>Vsd5"sJ+5p<^`i2T?=pV3Hn2M!(41bqK(K]Ak0ENkTS[/6S2]^m!3@IR48`_FJuX#hY$s&iB6,f:PZLO>#VH`#=,alX2W2h(>k01?Fk:/-HB+LVn88cl,DR><%mDj'D=)jCp,:c:.*3-u5RWZ8Il3n#k1cWY7d>g[f;9p$T7g8d28EK%!Mq3jILF8=FDlE%qHbSi6(g9n*DiXN0C9](`=ObV)C7P)jd<neKZB*b"F67u`X'sZFbmL&R0)\qd^Ws]>5o1m-@W'2elGB,RAhYeMsEP#$c$:DnZ?G]-fW7=sn=e,n&oS"];rlYq>)^.mLTbCP-j?uEkZeF\n-`Tl86R&oe1)5P&0*_e"B#q)lqB6p!+91&Z>7b\l+$s#!J.#4l:2T]m($40on_a+>9\PK0TeXKeO!62S&m7pcgWJMLf-5W,k?4hA5Y[X[=@8tqojp=5C#AjCf2r/C&@-hp=:ejU<$GG(mRIq5@N`i$K)LNlKL<nh!s?IYLcGiP!a+*S:Wr-PV&nFj;8<9GW,H)M\TWS/f$4f/[RmL.BB?.=9.I(,]%e%DFqk,5f@np72d5TPCPuB1iJAlEL].eu0.cA~>
endstream
endobj
6 0 obj
@@ -20,10 +20,10 @@ endobj
>>
endobj
7 0 obj
-<< /Length 828 /Filter [ /ASCII85Decode /FlateDecode ]
+<< /Length 855 /Filter [ /ASCII85Decode /FlateDecode ]
>>
stream
-GatUr?#Q2d'Sc)J.t"m6i;!J)E7n:8UoBPY"_j1OBl_"bX9;F?ReGXbHj-#I+joB93:Zl0a$04e9t:&4AcNL#5a\VafW?hmp58sF^)c9n6]QO*m_S?f%tq/;i*jikrTVenPib%H1Xq)-hg_fE*tWn-(Ar!rbPOgs/r4<4:VE^:LqK\-9pon4WcdMnfK54UOUC;J0`Fb<dY!QY[@!-`(^.c7\`>j^/p"*r68HM`P]<kN@T"2]5YBYf*GOss_o[K1U']+PhsYALg>Mt/bI:77/AZ'q-5i&]`",jK\m/PmU.NUl]M.^8T6\a?NHaU1-?I,<!T__;IA?DtENdN_C+1t#XCWHbCe(dPFT-A^hmOsU9j6W$!JMQ0`&3EWjZ,dc?-V^$qo*([?&C#pH(G47fBbQCoMDp\U>.9jJZT[<8@jP4FmtQ#GQu]b_,/2hW*cqemD[f,DN$')NgK4@Zo8hG4jD@gAZE%];Lp/*ak\]"q.Nni.Z_'XlXE]4+iW6EbSh"qlD<Z_)4irJh,STpIERUR%VniN-,+0I?9_F;4GQPNjPec[G'B62=6`^T.<-r>??;,7e&c*!\'pD/C.J6PaE99EOO/2U07f9_+RBe9Jp,9`2,2$rgCXQ9[Kt@[Bs/#l=K&Zrql_2`_YO>aq>$\4$!5Htj!Uc;Z0aH$fq#5I":51,#0H.ZF]6&@n0KEfGZ7QPpeZj@Dg+:pT8_4:W-`C7m"E\SD_B7Mceo4&h^4:dWS?G%<i3K!e*+o"h&cp?6UVLF6PM`L+h0_7BH1rJ`10de)Hdls4BD,l%nG*SC^:sJC(tI<>@2I\LUI!iPAbc-~>
+GatUr?#SFN'Sc)P'u"K;iqXhuaCSS88Q."=!bmkLBemMu=[PLh;qc^ck5u?L]LXJV*CJ]X3R0WK^0T#Jbo+;",-XaQ#]+)i+T'-.d*OCc`Z[hq=DksYX%,M/2$bmJaSp:hfU$0Sce!>sTk<E4jl[Q[#0X4$KqDV1%O!!Wo?d1*X'X>fLkE4Y9pr/9l=A?-YR@"^PR89(8.TFKR>ctJjFXlG(RV>B(aG?.GSkq+cfn3.;`/tb"cOYbR[eF?HC#4E(.Af1=Gq3jCGV@m7kg+S[C@>BHAlj$#YGWjcYrP9,&QhRfB%?,GEQ@A-KB^[r3"17Qd^j][&NTqeF_KR$XRS:@+UflF2Y]l%/mS^X7Q+#X30U?.Pp1fAKJFa#-q`\`*_&=D9@3h(AW&;@2CV;NFGt7N"PldH%,?=R>dk]nO1'LdY-%UZh$$&IF6>uEi[Ch?ELGBdPX_"6]`:Aa%us1%Y-4dR.aqTBGX.'7Sb'2<(M@fES&\+9i7c;)^f4LgEcOj=Qb<R?)W.a.c)M)8e*<4Y%?1/"P$@q%$qTFf5sO5M=s(kC-&H`*_JcNYW[H8:3[0^;fD7Y@f(>G%p'ZI81AO1Wh\\^(QGB&NTtN[Z*&9"%ujig"9B-ik;O8M-kJ9E9VV6C7;A9K'6YQ*:2CN>q=@YSS@,1sAa[<j`!P`3<9L/KrOeZ61tT+57`9K(#\M8a%M0loPStgRLY6NmYJ]Ojbi2Jk5nlX7U>rc<\Gg$#-:Zh)ct4Xl2Rjc:AnM<\5__1*ge-B;]D"):4IJZ7f),G;)"&W#&FZCUPO='mSVi3mU.EKoQ%P?II1'$IBb(H0AQ^*3hUNb"G.,-M2=1)*+,Xj1i;~>
endstream
endobj
8 0 obj
@@ -87,19 +87,19 @@ endobj
xref
0 14
0000000000 65535 f
-0000002963 00000 n
-0000003027 00000 n
-0000003077 00000 n
+0000002995 00000 n
+0000003059 00000 n
+0000003109 00000 n
0000000015 00000 n
0000000071 00000 n
-0000001275 00000 n
-0000001381 00000 n
-0000002300 00000 n
-0000002406 00000 n
-0000002518 00000 n
-0000002628 00000 n
-0000002739 00000 n
-0000002847 00000 n
+0000001280 00000 n
+0000001386 00000 n
+0000002332 00000 n
+0000002438 00000 n
+0000002550 00000 n
+0000002660 00000 n
+0000002771 00000 n
+0000002879 00000 n
trailer
<<
/Size 14
@@ -107,5 +107,5 @@ trailer
/Info 4 0 R
>>
startxref
-3199
+3231
%%EOF
diff --git a/docs/lucene-sandbox/index.html b/docs/lucene-sandbox/index.html
index 4b806563ec8..a7fd3aa0677 100644
--- a/docs/lucene-sandbox/index.html
+++ b/docs/lucene-sandbox/index.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="../api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="../api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="../api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/queryparsersyntax.html b/docs/queryparsersyntax.html
index 7331b97aca6..32f77c7e987 100644
--- a/docs/queryparsersyntax.html
+++ b/docs/queryparsersyntax.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/docs/scoring.html b/docs/scoring.html
index 67428d1907d..8e5b2f9d669 100644
--- a/docs/scoring.html
+++ b/docs/scoring.html
@@ -139,6 +139,9 @@ document.write("Last Published: " + document.lastModified);
<a href="api/contrib-benchmark/index.html">Benchmark</a>
</div>
<div class="menuitem">
+<a href="api/contrib-collation/index.html">Collation</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
diff --git a/lucene-contrib-pom.xml.template b/lucene-contrib-pom.xml.template
index 26aa52c721b..a0b0d3a12a7 100644
--- a/lucene-contrib-pom.xml.template
+++ b/lucene-contrib-pom.xml.template
@@ -44,5 +44,6 @@
<commons-collections-version>3.1</commons-collections-version>
<commons-beanutils-version>1.7.0</commons-beanutils-version>
<jakarta-regexp-version>1.4</jakarta-regexp-version>
+ <icu-version>4.0</icu-version>
</properties>
</project>
diff --git a/src/site/src/documentation/content/xdocs/site.xml b/src/site/src/documentation/content/xdocs/site.xml
index 130471f3337..23f6c71ec7e 100755
--- a/src/site/src/documentation/content/xdocs/site.xml
+++ b/src/site/src/documentation/content/xdocs/site.xml
@@ -53,6 +53,7 @@ See http://forrest.apache.org/docs/linking.html for more info
<javadoc-contrib-bdb label="Bdb" href="ext:javadocs-contrib-bdb"/>
<javadoc-contrib-bdb-je label="Bdb-je" href="ext:javadocs-contrib-bdb-je"/>
<javadoc-contrib-benchmark label="Benchmark" href="ext:javadocs-contrib-benchmark"/>
+ <javadoc-contrib-collation label="Collation" href="ext:javadocs-contrib-collation"/>
<javadoc-contrib-highlighter label="Highlighter" href="ext:javadocs-contrib-highlighter"/>
<javadoc-contrib-instantiated label="Instantiated" href="ext:javadocs-contrib-instantiated"/>
<javadoc-contrib-lucli label="Lucli" href="ext:javadocs-contrib-lucli"/>
@@ -100,6 +101,7 @@ See http://forrest.apache.org/docs/linking.html for more info
<javadocs-contrib-bdb href="api/contrib-bdb/index.html"/>
<javadocs-contrib-bdb-je href="api/contrib-bdb-je/index.html"/>
<javadocs-contrib-benchmark href="api/contrib-benchmark/index.html"/>
+ <javadocs-contrib-collation href="api/contrib-collation/index.html"/>
<javadocs-contrib-highlighter href="api/contrib-highlighter/index.html"/>
<javadocs-contrib-instantiated href="api/contrib-instantiated/index.html"/>
<javadocs-contrib-lucli href="api/contrib-lucli/index.html"/>