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 "randolf.julian" <ra...@dominionenterprises.com> on 2012/04/12 17:14:31 UTC

Import null values from XML file

We import an XML file directly to SOLR using a the script called post.sh in
the exampledocs. This is the script:

FILES=$*
URL=http://localhost:8983/solr/update

for f in $FILES; do
  echo Posting file $f to $URL
  curl $URL --data-binary @$f -H 'Content-type:text/xml; charset=utf-8'
  echo
done

#send the commit command to make sure all the changes are flushed and
visible
curl $URL --data-binary '<commit/>' -H 'Content-type:text/xml;
charset=utf-8'
echo

Our XML file looks something like this:

<add>
  <doc>
    <field name="ProductGuid">D22BF0B9-EE3A-49AC-A4D6-000B07CDA18A</field>
    <field name="SkuGuid">D22BF0B9-EE3A-49AC-A4D6-000B07CDA18A</field>
    <field name="ProductGroupId">1000</field>
    <field name="VendorSkuCode">CK4475</field>
    <field name="VendorSkuAltCode">CK4475</field>
    <field name="ManufacturerSkuCode">NULL</field>
    <field name="ManufacturerSkuAltCode">NULL</field>
    <field name="UpcEanSkuCode">840655037330</field>
    <field name="VendorSupersededSkuCode">NULL</field>
    <field name="VendorProductDescription">EBC CLUTCH KIT</field>
    <field name="VendorSkuDescription">EBC CLUTCH KIT</field>
  </doc>
</add>

How can I tell solr that the "NULL" value should be treated as null?

Thanks,
Randolf 

--
View this message in context: http://lucene.472066.n3.nabble.com/Import-null-values-from-XML-file-tp3905600p3905600.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Import null values from XML file

Posted by Erick Erickson <er...@gmail.com>.
What does "treated as null" mean? Deleted from the doc?
The problem here is that null-ness is kind of tricky. What
behaviors do you want out of Solr in the NULL case?

You can drop this out of the document by writing a custom
updateHandler. It's actually quite simple to do.

Best
Erick

On Thu, Apr 12, 2012 at 9:14 AM, randolf.julian
<ra...@dominionenterprises.com> wrote:
> We import an XML file directly to SOLR using a the script called post.sh in
> the exampledocs. This is the script:
>
> FILES=$*
> URL=http://localhost:8983/solr/update
>
> for f in $FILES; do
>  echo Posting file $f to $URL
>  curl $URL --data-binary @$f -H 'Content-type:text/xml; charset=utf-8'
>  echo
> done
>
> #send the commit command to make sure all the changes are flushed and
> visible
> curl $URL --data-binary '<commit/>' -H 'Content-type:text/xml;
> charset=utf-8'
> echo
>
> Our XML file looks something like this:
>
> <add>
>  <doc>
>    <field name="ProductGuid">D22BF0B9-EE3A-49AC-A4D6-000B07CDA18A</field>
>    <field name="SkuGuid">D22BF0B9-EE3A-49AC-A4D6-000B07CDA18A</field>
>    <field name="ProductGroupId">1000</field>
>    <field name="VendorSkuCode">CK4475</field>
>    <field name="VendorSkuAltCode">CK4475</field>
>    <field name="ManufacturerSkuCode">NULL</field>
>    <field name="ManufacturerSkuAltCode">NULL</field>
>    <field name="UpcEanSkuCode">840655037330</field>
>    <field name="VendorSupersededSkuCode">NULL</field>
>    <field name="VendorProductDescription">EBC CLUTCH KIT</field>
>    <field name="VendorSkuDescription">EBC CLUTCH KIT</field>
>  </doc>
> </add>
>
> How can I tell solr that the "NULL" value should be treated as null?
>
> Thanks,
> Randolf
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Import-null-values-from-XML-file-tp3905600p3905600.html
> Sent from the Solr - User mailing list archive at Nabble.com.