You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Steve Rowe (JIRA)" <ji...@apache.org> on 2015/07/02 19:42:04 UTC
[jira] [Created] (SOLR-7749) Schema API: commands (e.g.
add-field-type) should fail if unknown params are supplied
Steve Rowe created SOLR-7749:
--------------------------------
Summary: Schema API: commands (e.g. add-field-type) should fail if unknown params are supplied
Key: SOLR-7749
URL: https://issues.apache.org/jira/browse/SOLR-7749
Project: Solr
Issue Type: Bug
Reporter: Steve Rowe
Priority: Minor
On the solr-user mailing list, Søren reported trying to add a field type via the Schema API. The command partially succeeded by ignoring mistyped params - below I reproduced the problem using data_driven_schema_configs:
{noformat}
PROMPT$ curl -X POST http://localhost:8983/solr/gettingstarted/schema -H 'Content-type: application/json' -d '{
"add-field-type":{
"name":"myTxtField",
"class":"solr.TextField",
"positionIncrementGap":"100",
"analyzer":{
"charFilter": {"class":"solr.MappingCharFilterFactory", "mapping":"mapping-ISOLatin1Accent.txt"},
"filter": {"class":"solr.LowerCaseFilterFactory"},
"tokenizer": {"class":"solr.StandardTokenizerFactory"}
}
}
}'
{
"responseHeader":{
"status":0,
"QTime":68}}
PROMPT$ curl "http://localhost:8983/solr/gettingstarted/schema/fieldtypes/myTxtField"
{
"responseHeader":{
"status":0,
"QTime":123},
"fieldType":{
"name":"myTxtField",
"class":"solr.TextField",
"positionIncrementGap":"100",
"analyzer":{
"tokenizer":{
"class":"solr.StandardTokenizerFactory"}},
"fields":[],
"dynamicFields":[]}}
{noformat}
Only the tokenizer is included in the field type, because "charFilter" and "filter" are misspelled and have the wrong value type: both should be plural and should have array values.
The above request succeeded by ignoring the misspelled params - no charFilter or filter was created in the analyzer. It really should have failed and sent back an error explaining the problem.
The following succeeds for me (after first issuing a {{delete-field-type}} command and copying {{mapping-ISOLatin1Accent.txt}} into the {{gettingstarted/conf/}} directory):
{noformat}
curl -X POST http://localhost:8983/solr/gettingstarted/schema -H 'Content-type: application/json' -d '{
"add-field-type":{
"name":"myTxtField",
"class":"solr.TextField",
"positionIncrementGap":"100",
"analyzer":{
"charFilters": [{"class":"solr.MappingCharFilterFactory", "mapping":"mapping-ISOLatin1Accent.txt"}],
"tokenizer": {"class":"solr.StandardTokenizerFactory"},
"filters": [{"class":"solr.LowerCaseFilterFactory"}]
}
}
}'
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org