Marius Grama created SOLR-7697:
----------------------------------
Summary: Schema API doesn't take class attribute into account for
the analyzer when adding a new field type
Key: SOLR-7697
URL: https://issues.apache.org/jira/browse/SOLR-7697
Project: Solr
Issue Type: Bug
Components: Schema and Analysis
Affects Versions: 5.2
Reporter: Marius Grama
Fix For: 5.3, Trunk
I've noticed that in schema.xml can be defined field types like the following :
{code}
<fieldType name="nametext" class="solr.TextField">
<analyzer class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
</fieldType>
{code}
The current add-field-type update operation from Schema API doesn't take into
account the class for the field type analyzer definition, but only their type.
See FieldTypeXmlAdapter.java
{code}
protected static Element createAnalyzerElement(Document doc, String type,
Map<String,?> json) {
Element analyzer = doc.createElement("analyzer");
if (type != null)
analyzer.setAttribute("type", type);
.....
{code}
If the change would be made, the add-field-type request would look like this :
{code}
curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-field-type": {
"name": "nametext",
"class": "solr.TextField",
"analyzer": {
"class": "org.apache.lucene.analysis.core.WhitespaceAnalyzer"
}
}
}' http://localhost:8983/solr/gettingstarted/schema
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]