[ https://issues.apache.org/jira/browse/SOLR-12185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16426322#comment-16426322 ]
Shawn Heisey commented on SOLR-12185: ------------------------------------- bq. Solr can't purge anything when you delete a field, Followup on this point: You can't just delete a field in a Lucene index. Reindexing every document containing that field (and making sure that the field is NOT in the new document) would be required. Reindexing a document involves marking the old copy as deleted and indexing a new copy, so you've got the same issue -- old versions with that field are STILL in the index, unless you force a merge of the entire index to purge deleted documents. Solr uses the term "optimize" for what Lucene has renamed to forceMerge. That operation can quite literally take hours, and the I/O required can affect performance drastically, so it's NOT something you want to happen automatically. > Can't change Single Valued field to Multi Valued even by deleting/readding > -------------------------------------------------------------------------- > > Key: SOLR-12185 > URL: https://issues.apache.org/jira/browse/SOLR-12185 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Components: Schema and Analysis > Affects Versions: 7.1 > Reporter: Cetra Free > Priority: Major > > Changing a single-valued field to multi-valued field with doc values breaks > things. This doesn't matter if you change the field or do a complete delete > and re-add of the field. The only way I have found to "fix" this is to > delete the entire core from disk and re-add it. > h2. Steps to replicate: > * Create a field, make it single valued with doc values > * Index a couple of docs > * Delete the field > * Add the field again with the same name, but change it to multiValued > * Try indexing a couple of docs > h2. Expected result: > The documents are indexed correctly and there are no issues > h2. Actual outcome: > The documents refuse to be indexed and you see this in the logs: > {code:java} > org.apache.solr.common.SolrException: Exception writing document id > 6a3226c8-c904-40d7-aecb-76c3515db7b8 to the index; possible analysis error: > cannot change DocValues type from SORTED to SORTED_SET for field > "example_field" > at > org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:221) > at > org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:67) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:991) > at > org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1207) > at > org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:753) > at > org.apache.solr.update.processor.LogUpdateProcessorFactory$LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:103) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.AddSchemaFieldsUpdateProcessorFactory$AddSchemaFieldsUpdateProcessor.processAdd(AddSchemaFieldsUpdateProcessorFactory.java:474) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.FieldMutatingUpdateProcessor.processAdd(FieldMutatingUpdateProcessor.java:118) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.FieldMutatingUpdateProcessor.processAdd(FieldMutatingUpdateProcessor.java:118) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.FieldMutatingUpdateProcessor.processAdd(FieldMutatingUpdateProcessor.java:118) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.FieldMutatingUpdateProcessor.processAdd(FieldMutatingUpdateProcessor.java:118) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.FieldNameMutatingUpdateProcessorFactory$1.processAdd(FieldNameMutatingUpdateProcessorFactory.java:74) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.FieldMutatingUpdateProcessor.processAdd(FieldMutatingUpdateProcessor.java:118) > at > org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55) > at > org.apache.solr.update.processor.AbstractDefaultValueUpdateProcessorFactory$DefaultValueUpdateProcessor.processAdd(AbstractDefaultValueUpdateProcessorFactory.java:91) > at > org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:80) > at > org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:257) > at > org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:527) > at > org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:415) > at > org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:330) > at > org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:233) > at > org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:415) > at > org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:474) > at > org.apache.solr.handler.dataimport.DataImporter.lambda$runAsync$0(DataImporter.java:457) > at java.lang.Thread.run(Thread.java:748) > Caused by: java.lang.IllegalArgumentException: cannot change DocValues type > from SORTED to SORTED_SET for field "example_field" > at > org.apache.lucene.index.FieldInfos$FieldNumbers.verifyConsistent(FieldInfos.java:293) > at > org.apache.lucene.index.FieldInfos$FieldNumbers.setDocValuesType(FieldInfos.java:341) > at > org.apache.lucene.index.DefaultIndexingChain.indexDocValue(DefaultIndexingChain.java:524) > at > org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:466) > at > org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:392) > at > org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:239) > at > org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:481) > at > org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1717) > at > org.apache.solr.update.DirectUpdateHandler2.updateDocument(DirectUpdateHandler2.java:960) > at > org.apache.solr.update.DirectUpdateHandler2.updateDocOrDocValues(DirectUpdateHandler2.java:949) > at > org.apache.solr.update.DirectUpdateHandler2.doNormalUpdate(DirectUpdateHandler2.java:329) > at > org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:266) > at > org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:216) > ... 32 more{code} > > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org