mirror of https://github.com/apache/lucene.git
SOLR-3682: Fail to parse schema.xml if uniqueKeyField is multivalued
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1367316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f96ac59060
commit
8e7b2cf4aa
|
@ -34,6 +34,15 @@ Velocity 1.6.4 and Velocity Tools 2.0
|
|||
Apache UIMA 2.3.1
|
||||
Apache ZooKeeper 3.3.5
|
||||
|
||||
Upgrading from Solr 4.0.0-ALPHA
|
||||
----------------------
|
||||
|
||||
Solr is now much more strict about requiring that the uniqueKeyField feature
|
||||
(if used) must refer to a field which is not multiValued. If you upgrade from
|
||||
an earlier version of Solr and see an error that your uniqueKeyField "can not
|
||||
be configured to be multivalued" please add 'multiValued="false"' to the
|
||||
<field /> declaration for your uniqueKeyField. See SOLR-3682 for more details.
|
||||
|
||||
Detailed Change List
|
||||
----------------------
|
||||
|
||||
|
@ -188,6 +197,8 @@ Other Changes
|
|||
* SOLR-3683: Improved error handling if an <analyzer> contains both an
|
||||
explicit class attribute, as well as nested factories. (hossman)
|
||||
|
||||
* SOLR-3682: Fail to parse schema.xml if uniqueKeyField is multivalued (hossman)
|
||||
|
||||
================== 4.0.0-ALPHA ==================
|
||||
More information about this release, including any errata related to the
|
||||
release notes, upgrade instructions, or other changes may be found online at:
|
||||
|
|
|
@ -499,7 +499,10 @@ public final class IndexSchema {
|
|||
log.error("uniqueKey is not stored - distributed search will not work");
|
||||
}
|
||||
if (uniqueKeyField.multiValued()) {
|
||||
log.error("uniqueKey should not be multivalued");
|
||||
String msg = "uniqueKey field ("+uniqueKeyFieldName+
|
||||
") can not be configured to be multivalued";
|
||||
log.error(msg);
|
||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
|
||||
}
|
||||
uniqueKeyFieldName=uniqueKeyField.getName();
|
||||
uniqueKeyFieldType=uniqueKeyField.getType();
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?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.
|
||||
-->
|
||||
|
||||
<schema name="bad-schema-uniquekey-multivalued" version="1.4">
|
||||
<types>
|
||||
<fieldType name="string" class="solr.StrField" multiValued="true"/>
|
||||
</types>
|
||||
|
||||
<fields>
|
||||
<!-- BEGIN BAD STUFF: multiValued inherited from field type -->
|
||||
<field name="id" type="string" indexed="true" stored="true" />
|
||||
<!-- END BAD STUFF -->
|
||||
</fields>
|
||||
|
||||
<defaultSearchField>id</defaultSearchField>
|
||||
<uniqueKey>id</uniqueKey>
|
||||
|
||||
</schema>
|
|
@ -62,6 +62,8 @@ public class BadIndexSchemaTest extends AbstractBadConfigTestBase {
|
|||
"can not be the dest of a copyField");
|
||||
doTest("bad-schema-uniquekey-uses-default.xml",
|
||||
"can not be configured with a default value");
|
||||
doTest("bad-schema-uniquekey-multivalued.xml",
|
||||
"can not be configured to be multivalued");
|
||||
}
|
||||
|
||||
public void testPerFieldtypeSimButNoSchemaSimFactory() throws Exception {
|
||||
|
|
|
@ -259,7 +259,7 @@
|
|||
best performance.
|
||||
-->
|
||||
|
||||
<field name="id" type="string" indexed="true" stored="true" required="true" />
|
||||
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
|
||||
<field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
|
||||
<field name="name" type="text" indexed="true" stored="true"/>
|
||||
<field name="nameSort" type="string" indexed="true" stored="false"/>
|
||||
|
|
|
@ -291,7 +291,7 @@
|
|||
|
||||
<field name="subject" type="text" indexed="true" stored="true" />
|
||||
<field name="title" type="text" indexed="true" stored="true" />
|
||||
<field name="link" type="string" indexed="true" stored="true" />
|
||||
<field name="link" type="string" indexed="true" stored="true" multiValued="false" />
|
||||
<field name="description" type="html" indexed="true" stored="true" />
|
||||
<field name="creator" type="string" indexed="false" stored="true" />
|
||||
<field name="item-subject" type="string" indexed="true" stored="false" />
|
||||
|
|
|
@ -259,7 +259,7 @@
|
|||
best performance.
|
||||
-->
|
||||
|
||||
<field name="id" type="string" indexed="true" stored="true" required="true" />
|
||||
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
|
||||
<field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
|
||||
<field name="name" type="text" indexed="true" stored="true"/>
|
||||
<field name="nameSort" type="string" indexed="true" stored="false"/>
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
trailing underscores (e.g. _version_) are reserved.
|
||||
-->
|
||||
|
||||
<field name="id" type="string" indexed="true" stored="true" required="true" />
|
||||
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
|
||||
<field name="sku" type="text_en_splitting_tight" indexed="true" stored="true" omitNorms="true"/>
|
||||
<field name="name" type="text_general" indexed="true" stored="true"/>
|
||||
<field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/>
|
||||
|
|
Loading…
Reference in New Issue