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

John Crygier updated SOLR-4588:
-------------------------------

    Attachment: schema.xml

Sample Schema
                
> Partial Update of Poly Field Corrupts Data
> ------------------------------------------
>
>                 Key: SOLR-4588
>                 URL: https://issues.apache.org/jira/browse/SOLR-4588
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.0
>            Reporter: John Crygier
>         Attachments: schema.xml
>
>
> When updating a field that is a poly type (Testing with LatLonType), when you 
> do a partial document update, the poly fields will become multi-valued.  This 
> occurs even when the field is configured to not be multi-valued.
> Test Case
> Use the following schema:
> <schema name='JohnTest' version='1.5'>
>       <fields>
>               <field name='id' type='String' indexed='true' stored='true' 
> required='true' multiValued='false' />
>               <field name='_version_' type='int' indexed='true' stored='true' 
> required='false' multiValued='false' />
>               
>               <dynamicField name='*LatLon' type='location' indexed='true' 
> stored='true' required='false' multiValued='false' />
>               <dynamicField name='*_coordinate' type='int' indexed='true' 
> stored='true' required='false' multiValued='false' />
>       </fields>
>       <uniqueKey>id</uniqueKey>
>       <types>
>               <fieldType sortMissingLast='true' name='String' 
> class='solr.StrField' />
>               <fieldType name="int" class="solr.TrieIntField" 
> precisionStep="0" positionIncrementGap="0"/>
>               <fieldType name="location" class="solr.LatLonType" 
> subFieldSuffix="_coordinate"/>               
>       </types>
> </schema>
> And issue the following commands (With responses):
> curl 'localhost:8983/solr/update?commit=true' -H 
> 'Content-type:application/json' -d '[{"id":"JohnTestDocument", 
> "JohnTestLatLon" : "0,0"}]'
> RESPONSE: {"responseHeader":{"status":0,"QTime":2133}}
> curl 'http://localhost:8983/solr/select?q=*%3A*&wt=json&indent=true'
> RESPONSE: {
>   "responseHeader":{
>     "status":0,
>     "QTime":2,
>     "params":{
>       "indent":"true",
>       "q":"*:*",
>       "wt":"json"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "id":"JohnTestDocument",
>         "JohnTestLatLon_0_coordinate":0.0,
>         "JohnTestLatLon_1_coordinate":0.0,
>         "JohnTestLatLon":"0,0",
>         "_version_":-1596981248}]
>   }}
>   
> curl 'localhost:8983/solr/update?commit=true' -H 
> 'Content-type:application/json' -d 
> '[{"id":"JohnTestDocument","JohnTestLatLon":{"set":"5,7"}}]'
> RESPONSE: {"responseHeader":{"status":0,"QTime":218}}
> curl 'http://localhost:8983/solr/select?q=*%3A*&wt=json&indent=true'
> RESPONSE: {
>   "responseHeader":{
>     "status":0,
>     "QTime":2,
>     "params":{
>       "indent":"true",
>       "q":"*:*",
>       "wt":"json"}},
>   "response":{"numFound":1,"start":0,"docs":[
>       {
>         "id":"JohnTestDocument",
>         "JohnTestLatLon_0_coordinate":[0.0,
>           5.0],
>         "JohnTestLatLon_1_coordinate":[0.0,
>           7.0],
>         "JohnTestLatLon":"5,7",
>         "_version_":-118489088}]
>   }}
> As you can see, the 0.0 hangs around in JohnTestLatLon_0_coordinate and 
> JohnTestLatLon_1_coordinate.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to