WELCOME!
What is Pinoy? It's a slang for Filipino, a person who comes from the Republic of the Philippines, or commonly known as the Philippine Islands (PI). I am a Filipino and works as an Oracle DBA in the United States. Whenever an issue arises or just for experiments, I usually forget what I did to solve/conduct them. There must be a central location where I can put everything. Thus, this blog was born. It's a collection of ideas, tips and tricks, scripts, or anything interesting that happened to me on an Oracle database or any other stuff.
The simpler, the better! has always been my motto. You don't have to complicate things. Simple things, for me, is always easier, just like my site.
FYI, anything that is written here is based on my personal experiences and is not endorsed by any other party. Also, I will not be held liable for issues that can arise by following whatever I did. Just like any other good DBA would say... ALWAYS TEST!
Hope you can find this site helpful in whatever you need and remember, I am not a guru.Jul 6, 2011
SOLR: dataImportHandler via HTTP
When querying the SOLR index using the admin console, the generated XML will look something similar to this:
<response>
<result name="response" numFound="471728" start="0">
<doc>
<str name="ID">98339511</str>
<str name="REMARKS">CUSTOM BUILT, 10,20,40 CUSTOM BUILT</str>
<str name="NICHE">4</str>
</doc>
<doc>
<str name="ID">98311340</str>
<str name="REMARKS">1986 MERCEDES_BENZ, MERCEDES BENZ L1113 CAB</str>
<str name="NICHE">4</str>
</doc>
</result>
</response>
If you notice, the node is named str and the field name is actually the value of the attribute named "name". To use the value of attribute, the xpath symbol @ was used. Thus, my data-config.xml ended up with this:
<dataConfig>
<dataSource type="HttpDataSource" />
<document>
<entity column="Doc"
pk="ID"
processor="XPathEntityProcessor"
url="http://host:port/solr/coreName/select/?q=NICHE%3A4"
onError="skip"
forEach="/response/result/doc/">
<field column="ID" xpath="/response/result/doc/str[@name='ID']" />
<field column="DESCRIPTION" xpath="/response/result/doc/str[@name='REMARKS']" />
<field column="SITE" xpath="/response/result/doc/str[@name='NICHE'] "/>
</entity>
</document>
</dataConfig>
The onError attribute signals SOLR to skip the document if it encounters an error.
No comments:
Post a Comment