简体   繁体   中英

Using solr search for mysql database table

I am new to solr and trying to use it to index my database "zend" and table "users". Below is the code of data-config.xml that is located at /solr/example/solr/conf/ folder

<dataConfig>
    <dataSource type="JdbcDataSource" 
              driver="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost/zend" 
              user="root" 
              password=""/>
    <document>
        <entity name="id" query="select id,first_name,last_name from users">
            <field column="id" name="solr_id"/>
            <field column="first_name" name="solr_first_name"/>
            <field column="last_name" name="solr_last_name"/>
        </entity>
    </document>
</dataConfig>

Below code I put in solrconfig.xml located at /solr/example/solr/conf folder

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
        <str name="config">data-config.xml</str>
    </lst>
</requestHandler>

And these fields I added in schema.xml of /solr/example/solr/conf folder

<field name="solr_id" type="genericID" indexed="true" stored="true"/>
<field name="solr_first_name" type="textgen" indexed="true" stored="true"/>
<field name="solr_last_name" type="textgen" indexed="true" stored="true"/>

After making these changes I run java -jar start.jar

When I hit the full import command from browser like

http://localhost:8983/solr/dataimport?command=full-import

Then I get the error:

HTTP ERROR: 500
Severe errors in solr configuration.
Check your log files for more detailed information on what may be wrong.
If you want solr to continue after configuration errors, change:
<abortOnConfigurationError>false</abortOnConfigurationError>
in null

Please advise.

You have an configuration error at your config - files. That could be for example an syntax error, missing end-tag or something like that. Your solution is written at your question:

Check your log files for more detailed information on what may be wrong.

So please check the output of your java-container.... probably the output of the java -jar command or the logfiles generated by java and/or the start.jar ..and post the output here

Witch version of Solr are you using? In never versions DIH is not in solr.war, but have to be loaded externally: SOLR-2365: DIH should not be in the Solr war

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM