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 2016/02/01 14:42:39 UTC

[jira] [Updated] (SOLR-8607) The Schema API refuses to add new fields that match existing dynamic fields

     [ https://issues.apache.org/jira/browse/SOLR-8607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Rowe updated SOLR-8607:
-----------------------------
    Attachment: SOLR-8607.patch

Patch with fix suggested on SOLR-8624, including tests that fail without the fix and succeed with it.

Running full test suite with the patch now.

> The Schema API refuses to add new fields that match existing dynamic fields
> ---------------------------------------------------------------------------
>
>                 Key: SOLR-8607
>                 URL: https://issues.apache.org/jira/browse/SOLR-8607
>             Project: Solr
>          Issue Type: Bug
>          Components: Schema and Analysis
>    Affects Versions: 5.3.1
>            Reporter: kiran
>            Priority: Minor
>         Attachments: SOLR-8607.patch
>
>
> If the all catch dynamic field '*' is present in a managed schema collection, then any field creation requests through Schema API return the confusing/weird error "Field $\{FIELD_NAME\} already exists".
> *Schema of a test collection*: 
> {code}
> curl -X GET http://localhost:8983/solr/testSQLQueries-eventsim/schema
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":0},
>   "schema":{
>     "name":"example",
>     "version":1.5,
>     "uniqueKey":"id",
>     "fieldTypes":[{
>         "name":"boolean",
>         "class":"solr.BoolField",
>         "sortMissingLast":true},
>       {
>         "name":"double",
>         "class":"solr.TrieDoubleField",
>         "positionIncrementGap":"0",
>         "precisionStep":"0"},
>       {
>         "name":"float",
>         "class":"solr.TrieFloatField",
>         "positionIncrementGap":"0",
>         "precisionStep":"0"},
>       {
>         "name":"int",
>         "class":"solr.TrieIntField",
>         "positionIncrementGap":"0",
>         "precisionStep":"0"},
>       {
>         "name":"long",
>         "class":"solr.TrieLongField",
>         "precisionStep":"6"},
>       {
>         "name":"string",
>         "class":"solr.StrField",
>         "sortMissingLast":true},
>       {
>         "name":"tdate",
>         "class":"solr.TrieDateField",
>         "positionIncrementGap":"0",
>         "precisionStep":"6"}],
>     "fields":[{
>         "name":"_root_",
>         "type":"string",
>         "indexed":true,
>         "stored":false},
>       {
>         "name":"_version_",
>         "type":"long",
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"id",
>         "type":"string",
>         "indexed":true,
>         "required":true,
>         "stored":true}],
>     "dynamicFields":[{
>         "name":"*_tdt",
>         "type":"tdate",
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_txt",
>         "type":"string",
>         "multiValued":true,
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_ss",
>         "type":"string",
>         "multiValued":true,
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_ii",
>         "type":"int",
>         "multiValued":true,
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_ls",
>         "type":"long",
>         "multiValued":true,
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_i",
>         "type":"int",
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_s",
>         "type":"string",
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_l",
>         "type":"long",
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_b",
>         "type":"boolean",
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_f",
>         "type":"float",
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*_d",
>         "type":"double",
>         "indexed":true,
>         "stored":true},
>       {
>         "name":"*",
>         "type":"string",
>         "indexed":true,
>         "stored":true}],
>     "copyFields":[]}}
> {code}
> *Create new field 'userId' using Schema API*
> {code}
> curl -X POST -H "Content-type:application/json" --data-binary '{"add-field": {"name":"userId","type":"string","indexed":"true","stored":"true"}}' http://localhost:8983/solr/testSQLQueries-eventsim/schema
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":6},
>   "errors":[{
>       "add-field":{
>         "name":"userId",
>         "type":"string",
>         "indexed":"true",
>         "stored":"true"},
>       "errorMessages":["Field 'userId' already exists.\n"]}]}
> {code}
> The field 'userId' does not exist in the schema but it is also not possible to add this field because of the dynamic field '*'.
> While one should never define dynamic field '*' in a managed schema, the Schema API should atleast return some useful error message.



--
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