Smart Folks:

I use JDBC to produce simple XML entities such as this one:

<awardtype>
  <entity_type>AWARDTYPE</entity_type>
  <movie_id>0</movie_id>
  <award_id>31</award_id>
  <festivalId>1</festivalId>
  <id>awardtypes::31:1</id>
</awardtype>

The XML entities are stored in file and loaded by the
FileListEntityProcessor.

In this case, the "movie_id" element has a value of zero because the JDBC
getString("movie_id") method returned null.  I can search Solr for
entities of this type (i.e. query on "entity_type:AWARDTYPE") and get back
the appropriate result set.  Then, I want to transform the result set into
JSON objects with fields that map to XML elements.

Today, I have to teach the JSON mapping that it should convert 0 to
JSONObject.NULL on a case-by-case basis -- I actually keep a mapping
document around that dictates whether a zero should be handled this way.

In some cases though, a zero may be legitimate where null values are also
legit.  Sure, I could always change the zero to a less likely integer or
such... 

=======
But doesn't Solr and the Data Import Handler have a better way to read a
null value from an XML entity during import, AND to represent it in search
results?  Do I need a different approach depending on my field's type?
=======

I apologize if this is an asked and answered question.  None of my web
searches turned up an answer.

Thanks,

David

Reply via email to