How could I properly configure Solr to index my Oracle database? -
i've been trying configure solr work oracle 11.2 database datasource nothing works. have thoroughly explored documentations , seems lack , working guide.
for simple scenario, want index single table [topic]
the structure of table topic shown below:
- id (autonumber)
- topic (varchar 50) i want index this
- info (varchar 255) i want index this
my solr configurations (so far)
i have added new collection oracle, name "oracle_test". configure folder structure guided official documentation collection follows:
- ~/solr/server/solr/
- oracle_test
- conf
- data-config.xml
- elevate.xml
- schema.xml
- solrconfig.xml
- conf
- oracle_test
data-config.xml
i have configured working datasource connection string oracle, specified query topic table, fields want solr up.
<dataconfig> <datasource name="jdbc" driver="oracle.jdbc.driver.oracledriver" url="jdbc:oracle:system@//127.0.0.1:1521/orcl/" user="system" password="*****"/> <document> <entity name="help" query="select \"topic\",\"info\" \"topic\"" datasource="jdbc"> <field column="topic" name="topic"/> <field column="info" name="info"/> </entity> </document> </dataconfig>
schema.xml
i put definitions of fields here.
<schema name="oracle_help" version="1.1"> <fieldtype name="string" class="solr.strfield"/> <field name="topic" type="string" indexed="true" stored="true" multivalued="false"/> <defaultsearchfield>info</defaultsearchfield> <field name="topic" type="string" indexed="true" stored="true"/> <field name="info" type="string" indexed="true" stored="true"/> </schema>
solrconfig.xml
since configuration file big , includes everything. take excerpts configuration file related oracle configuration follows:
i specify field (topic) want index:
<initparams path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse"> <lst name="defaults"> <str name="df">topic</str> </lst> </initparams>
under processor section, have 1 default field type defined string:
<processor class="solr.addschemafieldsupdateprocessorfactory"> <str name="defaultfieldtype">strings</str> ... </processor>
then tried importing datasource via solr admin
using "dataimport" on solr admin dashboard, once execute command, got response i'm not sure whether correctly indexed oracle table:
{ "responseheader": { "status": 0, "qtime": 1 }, "initargs": [ "defaults", [ "config", "data-config.xml" ] ], "command": "status", "status": "idle", "importresponse": "", "statusmessages": {} }
weird thing is, status indicated "idle".
i tried execute search query, returns error
use search query "test" follows:
$> curl http://localhost:8983/solr/oracle_test/select?q=test&wt=json&indent=true
solr returns me "undefined field topic".
{ "responseheader": { "status": 400, "qtime": 1, "params": { "q": "called", "indent": "true", "wt": "json", "_": "1434341618019" } }, "error": { "msg": "undefined field topic", "code": 400 } }
but, shown @ earlier part, have defined field "topic" in schema.xml. seems lack of documentation or guide on solr official sites , tried doing research on internet, i've got nothing @ all.
can might familiar solr - oracle integration please me figure out? suggestion?
i think solr server should generate error upon start-up or when trying access index uses schema.xml have defined. please have logs of solr server.
it has formal errors, these prevent index starting , in turn dih have defined running
<types />
missing around field types<fields />
missing around fields<defaultsearchfield />
missplaced inside fields- you have defined field named
topic
twice
the structure of schema.xml documented in solr's wiki. valid version of schema.xml sample below.
<schema name="oracle_help" version="1.1"> <types> <fieldtype name="string" class="solr.strfield"/> </types> <defaultsearchfield>info</defaultsearchfield> <fields> <field name="topic" type="string" indexed="true" stored="true" multivalued="false"/> <field name="info" type="string" indexed="true" stored="true"/> </fields> </schema>
Comments
Post a Comment