I'm attempting to use and XML/HTTP datasource
[http://wiki.apache.org/solr/DataImportHandler#head-13ffe3a5e6ac22f08e063ad3315f5e7dda279bd4]
I went through the RSS example in
apache-solr-1.3.0/example/example-DIH and that all worked for me.

What I am now attempting to do is leverage 'useSolrAddSchema="true"' .
I have a URL the responds with a well formatted solr add xml (I'm able
to add it by POSTing).  But when I try to add it using
http://localhost:8983/solr/dataimport?command=full-import i get a null
pointer exception.

I am a little unsure if my data-config.xml is correct (I couldn't find
many examples that used useSolrAddSchema="true")  but I've tried every
alternate setting I could think of.
Any help is very much appreciated (I'm sure I've just missed something simple)

regards,
sam

using solr 1.3.0 on OSX 10.5.6

===== solrconfig.xml =====

<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str 
name="config">/Users/sam/src/apache-solr-1.3.0/example/solr/conf/data-config.xml</str>
    </lst>
  </requestHandler>

======= data-config.xml =======
<dataConfig>
        <dataSource name="smwe" type="HttpDataSource" encoding="UTF-8"/>
        <document>
                <entity name="smwe_factsheets"
                                url="http://local.smwe.com/factsheets/feed";
                        useSolrAddSchema="true"
                        dataSource="smwe">
                </entity>
        </document>
</dataConfig>

====== solr add xml returned by http://local.smwe.com/factsheets/feed =======
<add>
        <doc>
                <field name="id">100</field>
                <field name="brand">Antinori</field>
                <field name="varietal">Chardonnay</field>
                <field name="vintage">2007</field>
                <field name="tier">Castello della Sala</field>

                <field name="appellation">Cevaro della Sala</field>
                <field name="tasting_notes">Vibrant aromas of citrus
fruit, pineapple, pears and acacia flowers blend on the nose.The
rounded palate has sweet hints of hazelnut butter but is also
minerally and lingering. This wine will age and develop very
well.</field>
                <field name="food_pairings">bar</field>
        </doc>
</add>

===== fields section in schema.xml
<schema>

......

 <fields>

   <field name="id" type="string" indexed="true" stored="true"
required="true" />
   <field name="brand" type="string" indexed="true" stored="true"
omitNorms="true"/>
   <field name="varietal" type="string" indexed="true" stored="true"
omitNorms="true"/>
   <field name="vintage" type="string" indexed="true" stored="true"
omitNorms="true"/>
   <field name="tier" type="string" indexed="true" stored="true"
omitNorms="true"/>
   <field name="appellation" type="string" indexed="true"
stored="true" omitNorms="true"/>
   <field name="tasting_notes" type="text" indexed="true" stored="true" />
   <field name="food_pairings" type="text" indexed="true" stored="true" />
   <field name="all" type="text" indexed="true" stored="true"
multiValued="true"/>

.....

 <uniqueKey>id</uniqueKey>

 <!-- field for the QueryParser to use when an explicit fieldname is absent -->
 <defaultSearchField>all</defaultSearchField>

 <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
 <solrQueryParser defaultOperator="OR"/>

  <!-- copyField commands copy one field to another at the time a document
        is added to the index.  It's used either to index the same
field differently,
        or to add multiple fields to the same field for easier/faster
searching.  -->
        <copyField source="brand" dest="all"/>
    <copyField source="varietal" dest="all"/>
    <copyField source="vintage" dest="all"/>
    <copyField source="tier" dest="all"/>
    <copyField source="appellation" dest="all"/>
    <copyField source="tasting_notes" dest="all"/>
    <copyField source="food_pairings" dest="all"/>

 .......

</schema>

===== exception =====

Mar 18, 2009 12:38:44 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/dataimport params={command=full-import}
status=0 QTime=0
Mar 18, 2009 12:38:44 PM
org.apache.solr.handler.dataimport.DataImporter doFullImport
INFO: Starting Full Import
Mar 18, 2009 12:38:44 PM org.apache.solr.update.DirectUpdateHandler2 deleteAll
INFO: [] REMOVING ALL DOCUMENTS FROM INDEX
Mar 18, 2009 12:38:44 PM
org.apache.solr.handler.dataimport.DataImporter doFullImport
SEVERE: Full Import failed
java.lang.NullPointerException
        at java.util.regex.Matcher.getTextLength(Matcher.java:1127)
        at java.util.regex.Matcher.reset(Matcher.java:284)
        at java.util.regex.Matcher.<init>(Matcher.java:205)
        at java.util.regex.Pattern.matcher(Pattern.java:879)
        at 
org.apache.solr.handler.dataimport.TemplateString.<init>(TemplateString.java:50)
        at 
org.apache.solr.handler.dataimport.TemplateString.replaceTokens(TemplateString.java:72)
        at 
org.apache.solr.handler.dataimport.VariableResolverImpl.replaceTokens(VariableResolverImpl.java:77)
        at 
org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:74)
        at 
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:285)
        at 
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:178)
        at 
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:136)
        at 
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:334)
        at 
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
        at 
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:377)

Reply via email to