Also you may use the script transformer to explicitly remove the field from the document if the field is null. I do this for all my sdouble and sdate fields ... its a bit manual and I would like to see Solr enhanced to simply skip stuff like this by having a flag for its DIH code but until then it suffices:
... transformer="DateFormatTransformer,script:skipEmptyFields" <script> <![CDATA[ function skipEmptyFields(row) { var regularPrice = row.get( 'regularPrice' ); if ( regularPrice == null || regularPrice == '' ) { row.remove( 'regularPrice' ); } var salePrice = row.get( 'salePrice' ); if ( salePrice == null || salePrice == '' ) { row.remove( 'salePrice' ); } return row; } ]]> </script> On Wed, Sep 21, 2011 at 6:06 AM, Gora Mohanty <g...@mimirtech.com> wrote: > On Wed, Sep 21, 2011 at 4:08 PM, mechravi25 <mechrav...@yahoo.co.in> wrote: >> Hi, >> >> I have a field in my source with data type as string and that field has NULL >> values. I am trying to index this field in solr as a date data type with >> multivalued = true. Following is the entry for that field in my schema.xml > [...] > > One cannot have NULL values as input for Solr date fields. The > multivalued part is irrelevant here. > > As it seems like you are getting the input data from a database, > you will need to supply some invalid date for NULL date values. > E.g., with mysql, we have: > COALESCE( CreationDate, STR_TO_DATE( '1970,1,1', '%Y,%m,%d' ) ) > The required syntax will be different for other databases. > > Regards, > Gora >