You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ma...@apache.org on 2022/09/21 19:58:52 UTC
[solr] branch branch_9x updated: SOLR-16219: ICUCollationField protected field IllegalAccessException from different classloader (#1028)
This is an automated email from the ASF dual-hosted git repository.
magibney pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 4ebfc21e049 SOLR-16219: ICUCollationField protected field IllegalAccessException from different classloader (#1028)
4ebfc21e049 is described below
commit 4ebfc21e049ec4dbcb7b6eda1cd019bee8051e38
Author: Michael Gibney <mi...@michaelgibney.net>
AuthorDate: Wed Sep 21 15:29:16 2022 -0400
SOLR-16219: ICUCollationField protected field IllegalAccessException from different classloader (#1028)
(cherry picked from commit 223f8107608a89a85107902de8b2231262b325ce)
---
solr/CHANGES.txt | 2 +
.../org/apache/solr/schema/ICUCollationField.java | 4 +-
.../test/analysis_extras_config/conf/schema.xml | 55 ++++++++++++++++++++++
.../analysis_extras_config/conf/solrconfig.xml | 28 +++++++++++
solr/packaging/test/test_modules.bats | 6 +++
5 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 71ab6fbffe1..558f813e7f1 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -135,6 +135,8 @@ Bug Fixes
* SOLR-16418: Introduce SolrResponseUtil to handle NPE during query timeout or exception when parsing SolrResponse (Kevin Risden)
+* SOLR-16219: ICUCollationField protected field IllegalAccessException from different classloader (Michael Gibney)
+
Other Changes
---------------------
* SOLR-16351: Upgrade Carrot2 to 4.4.3, upgrade randomizedtesting to 2.8.0. (Dawid Weiss)
diff --git a/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java b/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
index 6a4a9a7620f..af15435b207 100644
--- a/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
+++ b/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
@@ -125,8 +125,8 @@ public class ICUCollationField extends FieldType {
@Override
protected void init(IndexSchema schema, Map<String, String> args) {
- failHardOnUdvas = schema.luceneVersion.onOrAfter(UDVAS_FORBIDDEN_AS_OF);
- if (on(trueProperties, USE_DOCVALUES_AS_STORED)) {
+ failHardOnUdvas = schema.getDefaultLuceneMatchVersion().onOrAfter(UDVAS_FORBIDDEN_AS_OF);
+ if ((trueProperties & USE_DOCVALUES_AS_STORED) != 0) {
// fail fast at fieldType init
warnOrFailUdvas(failHardOnUdvas);
}
diff --git a/solr/packaging/test/analysis_extras_config/conf/schema.xml b/solr/packaging/test/analysis_extras_config/conf/schema.xml
new file mode 100644
index 00000000000..51fbedba4c9
--- /dev/null
+++ b/solr/packaging/test/analysis_extras_config/conf/schema.xml
@@ -0,0 +1,55 @@
+<?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.
+-->
+
+<!-- Test schema file for CollationField -->
+
+<schema name="test" version="1.0">
+
+ <fieldType name="string" class="solr.StrField" omitNorms="true" positionIncrementGap="0"/>
+
+ <!-- basic text field -->
+ <fieldType name="text" class="solr.TextField">
+ <analyzer>
+ <tokenizer class="solr.StandardTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="sort_ar_t" class="solr.ICUCollationField" locale="ar"/>
+ <fieldType name="sort_de_t" class="solr.ICUCollationField" locale="de" strength="primary"/>
+ <fieldType name="sort_tr_canon_t" class="solr.ICUCollationField" locale="tr" strength="primary"
+ decomposition="canonical"/>
+ <fieldType name="sort_da_t" class="solr.ICUCollationField" locale="da" strength="primary"/>
+
+ <field name="id" type="string" indexed="true" stored="true" multiValued="false" required="false"/>
+ <field name="_version_" type="string" indexed="true" docValues="true" stored="false" multiValued="false"/>
+ <field name="text" type="text" indexed="true" stored="false"/>
+ <field name="sort_ar" type="sort_ar_t" indexed="true" stored="false" multiValued="false"/>
+ <field name="sort_de" type="sort_de_t" indexed="true" stored="false" multiValued="false"/>
+ <field name="sort_tr_canon" type="sort_tr_canon_t" indexed="true" stored="false" multiValued="false"/>
+ <field name="sort_da" type="sort_da_t" indexed="true" stored="false" multiValued="false"/>
+
+
+ <uniqueKey>id</uniqueKey>
+
+ <!-- copy our text to some sort fields with different orders -->
+ <copyField source="text" dest="sort_ar"/>
+ <copyField source="text" dest="sort_de"/>
+ <copyField source="text" dest="sort_tr_canon"/>
+ <copyField source="text" dest="sort_da"/>
+</schema>
diff --git a/solr/packaging/test/analysis_extras_config/conf/solrconfig.xml b/solr/packaging/test/analysis_extras_config/conf/solrconfig.xml
new file mode 100644
index 00000000000..19de28ee1a6
--- /dev/null
+++ b/solr/packaging/test/analysis_extras_config/conf/solrconfig.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<config>
+ <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
+ <indexConfig>
+ <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
+ <lockType>single</lockType>
+ </indexConfig>
+ <requestHandler name="/select" class="solr.SearchHandler"></requestHandler>
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
+</config>
diff --git a/solr/packaging/test/test_modules.bats b/solr/packaging/test/test_modules.bats
index c9bfaad9210..c261aef4dfe 100644
--- a/solr/packaging/test/test_modules.bats
+++ b/solr/packaging/test/test_modules.bats
@@ -38,3 +38,9 @@ teardown() {
assert_output --partial '"RESPONSE_TIME":'
refute_output --partial '"EXCEPTION"'
}
+
+@test "icu collation in analysis-extras module" {
+ run solr start -c -Dsolr.modules=analysis-extras
+ run solr create_collection -c COLL_NAME -d test/analysis_extras_config/conf
+ assert_output --partial "Created collection 'COLL_NAME'"
+}