You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by jefferyyuan <yu...@gmail.com> on 2013/11/27 05:56:38 UTC

Re: Adding new field after data is already indexed

Check  Solr: Add new fields with Default Value for Existing Documents
<http://lifelongprogrammer.blogspot.com/2013/06/solr-use-doctransformer-to-change.html>  
If we only need search and display the new fields, we can do the following
steps.
  
  1. add the new field definition in schema.xml:
<field name="newFiled" type="tint" indexed="true" stored="true"
default="-1"/>

  2. We need update search query: when search default value for this
newFiled, also search null value: 
-(-newFiled:defaultValue AND newFiled:[* TO *])
  3. Use DocTransformer to add default value when there is no value in that
field for old data.

Some functions may not work such as sort, stats.



--
View this message in context: http://lucene.472066.n3.nabble.com/Adding-new-field-after-data-is-already-indexed-tp1862575p4103440.html
Sent from the Solr - User mailing list archive at Nabble.com.