SOLR-5228: Deprecate <fields> and <types> tags in schema.xml

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1580515 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erick Erickson 2014-03-23 15:40:52 +00:00
parent 40fc92d3c8
commit 9a8a4c7c7f
15 changed files with 58 additions and 96 deletions

View File

@ -142,6 +142,9 @@ New Features
* SOLR-5860: Use leaderConflictResolveWait in WaitForState during recovery/startup,
improve logging and force refresh cluster state every 15 seconds.
(Timothy Potter via shalin)
* SOLR-5228: Don't require <field> or <dynamicField> be inside of <fields> -- or
that <fieldType> be inside of <types>. (Erick Erickson)
* SOLR-5749: A new Overseer status collection API exposes overseer queue sizes, timing
statistics, success and error counts and last N failures per operation. (shalin)

View File

@ -111,9 +111,6 @@ public class SchemaXmlWriter extends TextResponseWriter {
} else if (schemaPropName.equals(IndexSchema.FIELD_TYPES)) {
writeFieldTypes((List<SimpleOrderedMap<Object>>)schemaProperties.getVal(schemaPropNum));
} else if (schemaPropName.equals(IndexSchema.FIELDS)) {
openStartTag(IndexSchema.FIELDS);
closeStartTag(false);
incLevel();
@SuppressWarnings("unchecked") List<SimpleOrderedMap<Object>> fieldPropertiesList
= (List<SimpleOrderedMap<Object>>)schemaProperties.getVal(schemaPropNum);
for (SimpleOrderedMap<Object> fieldProperties : fieldPropertiesList) {
@ -134,8 +131,6 @@ public class SchemaXmlWriter extends TextResponseWriter {
}
closeStartTag(true);
}
decLevel();
endTag(IndexSchema.FIELDS);
} else if (schemaPropName.equals(IndexSchema.COPY_FIELDS)) {
@SuppressWarnings("unchecked") List<SimpleOrderedMap<Object>> copyFieldPropertiesList
= (List<SimpleOrderedMap<Object>>)schemaProperties.getVal(schemaPropNum);
@ -156,9 +151,6 @@ public class SchemaXmlWriter extends TextResponseWriter {
}
private void writeFieldTypes(List<SimpleOrderedMap<Object>> fieldTypePropertiesList) throws IOException {
openStartTag(IndexSchema.TYPES);
closeStartTag(false);
incLevel();
for (SimpleOrderedMap<Object> fieldTypeProperties : fieldTypePropertiesList) {
SimpleOrderedMap<Object> analyzerProperties = null;
SimpleOrderedMap<Object> indexAnalyzerProperties = null;
@ -199,8 +191,6 @@ public class SchemaXmlWriter extends TextResponseWriter {
endTag(IndexSchema.FIELD_TYPE);
}
}
decLevel();
endTag(IndexSchema.TYPES);
}
private void writeSimilarity(SimpleOrderedMap<Object> similarityProperties) throws IOException {

View File

@ -463,8 +463,10 @@ public class IndexSchema {
final FieldTypePluginLoader typeLoader = new FieldTypePluginLoader(this, fieldTypes, schemaAware);
// /schema/types/fieldtype | /schema/types/fieldType
expression = stepsToPath(SCHEMA, TYPES, FIELD_TYPE.toLowerCase(Locale.ROOT)) // backcompat(?)
// /schema/fieldtype | /schema/fieldType | /schema/types/fieldtype | /schema/types/fieldType
expression = stepsToPath(SCHEMA, FIELD_TYPE.toLowerCase(Locale.ROOT)) // backcompat(?)
+ XPATH_OR + stepsToPath(SCHEMA, FIELD_TYPE)
+ XPATH_OR + stepsToPath(SCHEMA, TYPES, FIELD_TYPE.toLowerCase(Locale.ROOT))
+ XPATH_OR + stepsToPath(SCHEMA, TYPES, FIELD_TYPE);
NodeList nodes = (NodeList) xpath.evaluate(expression, document, XPathConstants.NODESET);
typeLoader.load(loader, nodes);
@ -637,9 +639,12 @@ public class IndexSchema {
ArrayList<DynamicField> dFields = new ArrayList<>();
// /schema/fields/field | /schema/fields/dynamicField
String expression = stepsToPath(SCHEMA, FIELDS, FIELD)
+ XPATH_OR + stepsToPath(SCHEMA, FIELDS, DYNAMIC_FIELD);
// /schema/field | /schema/dynamicField | /schema/fields/field | /schema/fields/dynamicField
String expression = stepsToPath(SCHEMA, FIELD)
+ XPATH_OR + stepsToPath(SCHEMA, DYNAMIC_FIELD)
+ XPATH_OR + stepsToPath(SCHEMA, FIELDS, FIELD)
+ XPATH_OR + stepsToPath(SCHEMA, FIELDS, DYNAMIC_FIELD);
NodeList nodes = (NodeList)xpath.evaluate(expression, document, XPathConstants.NODESET);
for (int i=0; i<nodes.getLength(); i++) {

View File

@ -17,22 +17,22 @@
-->
<schema name="add-schema-fields-update-processor" version="1.5">
<types>
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
<fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" multiValued="true" positionIncrementGap="0"/>
<fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
<fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="text" class="solr.TextField" multiValued="true" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
</types>
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
<fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" multiValued="true" positionIncrementGap="0"/>
<fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
<fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="text" class="solr.TextField" multiValued="true" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fields>
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="_version_" type="long" indexed="true" stored="true"/>

View File

@ -16,15 +16,14 @@
limitations under the License.
-->
<schema name="tiny" version="1.1">
<types>
<fieldType name="string" class="solr.StrField"/>
</types>
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true"/>
<field name="text" type="text" indexed="true" stored="true"/>
<dynamicField name="*_t" type="text" indexed="true" stored="true"/>
<dynamicField name="*" type="string" indexed="true" stored="true"/>
</fields>
<fieldType name="string" class="solr.StrField"/>
<field name="id" type="string" indexed="true" stored="true" required="true"/>
<field name="text" type="text" indexed="true" stored="true"/>
<dynamicField name="*_t" type="text" indexed="true" stored="true"/>
<dynamicField name="*" type="string" indexed="true" stored="true"/>
<uniqueKey>id</uniqueKey>
<types>

View File

@ -37,7 +37,7 @@
1.0: multiValued attribute did not exist, all fields are multiValued by nature
1.1: multiValued attribute introduced, false by default -->
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
@ -297,10 +297,7 @@ valued. -->
</analyzer>
</fieldtype>
</types>
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a previously defined type from the <types> section
@ -387,7 +384,6 @@ valued. -->
unknown fields indexed and/or stored by default -->
<!--dynamicField name="*" type="ignored" /-->
</fields>
<!-- Field to use to determine and enforce document uniqueness.
Unless this field is marked with required="false", it will be a required field

View File

@ -160,17 +160,17 @@ public class TestSchemaResource extends SolrRestletTestBase {
"/schema/uniqueKey = 'id'",
"/schema/defaultSearchField = 'text'",
"(/schema/types/fieldType)[1]/@name = 'HTMLstandardtok'",
"(/schema/types/fieldType)[2]/@name = 'HTMLwhitetok'",
"(/schema/types/fieldType)[3]/@name = 'boolean'",
"(/schema/fieldType)[1]/@name = 'HTMLstandardtok'",
"(/schema/fieldType)[2]/@name = 'HTMLwhitetok'",
"(/schema/fieldType)[3]/@name = 'boolean'",
"(/schema/fields/field)[1]/@name = 'HTMLstandardtok'",
"(/schema/fields/field)[2]/@name = 'HTMLwhitetok'",
"(/schema/fields/field)[3]/@name = '_version_'",
"(/schema/field)[1]/@name = 'HTMLstandardtok'",
"(/schema/field)[2]/@name = 'HTMLwhitetok'",
"(/schema/field)[3]/@name = '_version_'",
"(/schema/fields/dynamicField)[1]/@name = '*_coordinate'",
"(/schema/fields/dynamicField)[2]/@name = 'ignored_*'",
"(/schema/fields/dynamicField)[3]/@name = '*_mfacet'",
"(/schema/dynamicField)[1]/@name = '*_coordinate'",
"(/schema/dynamicField)[2]/@name = 'ignored_*'",
"(/schema/dynamicField)[3]/@name = '*_mfacet'",
"/schema/copyField[@source='title'][@dest='title_stemmed'][@maxChars='200']",
"/schema/copyField[@source='title'][@dest='dest_sub_no_ast_s']",

View File

@ -37,7 +37,7 @@
1.0: multiValued attribute did not exist, all fields are multiValued by nature
1.1: multiValued attribute introduced, false by default -->
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
@ -237,10 +237,10 @@
-->
<fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
</types>
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a previously defined type from the <types> section
@ -314,7 +314,6 @@
unknown fields indexed and/or stored by default -->
<!--dynamicField name="*" type="ignored" multiValued="true" /-->
</fields>
<!-- Field to use to determine and enforce document uniqueness.
Unless this field is marked with required="false", it will be a required field

View File

@ -41,7 +41,7 @@
1.1: multiValued attribute introduced, false by default
1.2: omitTf attribute introduced, true by default -->
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
@ -311,10 +311,6 @@
-->
<fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
</types>
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a previously defined type from the <types> section
@ -346,8 +342,6 @@
<field name="catchAllField" type="text" indexed="true" stored="true" omitNorms="true" multiValued="true"/>
</fields>
<copyField source="content" dest="catchAllField"/>
<copyField source="attachmentNames" dest="catchAllField"/>
<copyField source="attachment" dest="catchAllField"/>

View File

@ -37,7 +37,7 @@
1.0: multiValued attribute did not exist, all fields are multiValued by nature
1.1: multiValued attribute introduced, false by default -->
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
@ -237,10 +237,6 @@
-->
<fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
</types>
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a previously defined type from the <types> section
@ -314,8 +310,6 @@
unknown fields indexed and/or stored by default -->
<!--dynamicField name="*" type="ignored" multiValued="true" /-->
</fields>
<!-- Field to use to determine and enforce document uniqueness.
Unless this field is marked with required="false", it will be a required field
-->

View File

@ -37,7 +37,6 @@
1.0: multiValued attribute did not exist, all fields are multiValued by nature
1.1: multiValued attribute introduced, false by default -->
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
@ -187,15 +186,10 @@
-->
<fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
</types>
<fields>
<field name="title" type="string" indexed="true" stored="true"/>
<field name="author" type="string" indexed="true" stored="true" />
<field name="text" type="text" indexed="true" stored="true" />
</fields>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>text</defaultSearchField>

View File

@ -63,7 +63,6 @@
(int, float, boolean, string...)
-->
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a field type from the
@ -168,7 +167,6 @@
unknown fields to the schema. -->
<!--dynamicField name="*" type="ignored" multiValued="true" /-->
</fields>
<!-- Field to use to determine and enforce document uniqueness.
@ -232,7 +230,7 @@
<!-- copy name to alphaNameSort, a field designed for sorting by name -->
<!-- <copyField source="name" dest="alphaNameSort"/> -->
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
@ -1056,7 +1054,6 @@
</analyzer>
</fieldType>
</types>
<!-- Similarity is the scoring routine for each document vs. a query.
A custom Similarity or SimilarityFactory may be specified here, but

View File

@ -17,19 +17,15 @@
-->
<schema name="example core zero" version="1.1">
<types>
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
</types>
<fields>
<!-- general -->
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="type" type="string" indexed="true" stored="true" multiValued="false" />
<field name="name" type="string" indexed="true" stored="true" multiValued="false" />
<field name="core0" type="string" indexed="true" stored="true" multiValued="false" />
<field name="_version_" type="long" indexed="true" stored="true"/>
</fields>
<!-- field to use to determine and enforce document uniqueness. -->
<uniqueKey>id</uniqueKey>

View File

@ -17,19 +17,16 @@
-->
<schema name="example core one" version="1.1">
<types>
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
</types>
<fields>
<!-- general -->
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="type" type="string" indexed="true" stored="true" multiValued="false" />
<field name="name" type="string" indexed="true" stored="true" multiValued="false" />
<field name="core1" type="string" indexed="true" stored="true" multiValued="false" />
<field name="_version_" type="long" indexed="true" stored="true"/>
</fields>
<!-- field to use to determine and enforce document uniqueness. -->
<uniqueKey>id</uniqueKey>

View File

@ -63,7 +63,7 @@
(int, float, boolean, string...)
-->
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a field type from the
@ -242,7 +242,7 @@
unknown fields indexed and/or stored by default -->
<!--dynamicField name="*" type="ignored" multiValued="true" /-->
</fields>
<!-- Field to use to determine and enforce document uniqueness.
@ -302,7 +302,7 @@
<!-- copy name to alphaNameSort, a field designed for sorting by name -->
<!-- <copyField source="name" dest="alphaNameSort"/> -->
<types>
<!-- field type definitions. The "name" attribute is
just a label to be used by field definitions. The "class"
attribute and any other attributes determine the real
@ -1138,8 +1138,6 @@
<filter class="solr.SnowballPorterFilterFactory" language="Turkish"/>
</analyzer>
</fieldType>
</types>
<!-- Similarity is the scoring routine for each document vs. a query.
A custom Similarity or SimilarityFactory may be specified here, but