> I've analyzed my index application > and checked the XML before executing the http request and > the field it's empty: > > <field name="fieldX" /> > > It should be empty on SOLR. > > Probably something in the way between my application (.NET) > and the SOLR (Jetty on Ubuntu) adds the whitespace. > > Anyway, I'll try to remove the field but, as I validate > each doc to the SOLR schema, I must make some adjustments > and stop validate the doc. > I don't know if that will be acceptable... > > Thanks for your help.
Alternatively you can do this in solr side with an UpdateProcessor [1], something like: public void processAdd(AddUpdateCommand cmd) throws IOException { SolrInputDocument doc = cmd.getSolrInputDocument(); Object v = doc.getFieldValue( "fieldX" ); if( v != null ) { String fieldX = (String) v.toString(); if("".equals(fieldX.trim()) ) { doc.removeField( "fieldX" ); } } super.processAdd(cmd); } [1] http://wiki.apache.org/solr/UpdateRequestProcessor