The installation directory is assumed to be #solr_home, and the #solr_home for this article is APPS/SVR/SOLR
1. Create a new folder under #solr_home/server/solr, assuming MJD
2. Copy the Conf folder under #solr_home/server/solr/configsets/_default to the #solr_home/server/solr/mjd
3. Open the Solrconfig.xml add node under mjd/conf
<lib dir= "${solr.install.dir: /.. /.. /..} /contrib/dataimporthandler/"regex=". *\.jar "><lib dir=" ${solr.install.dir:.. /.. /.. /..} /dist/"regex=" Solr-dataimporthandler-.*\.jar ">
4. The same file above, add the node
<requesthandler name= "/dataimport" class= "Org.apche.solr.handler.dataimport.DataImportHandler" ><lst name = "Defaults" ><str name= "config" >data-config.xml</str></list></requestHandler>
5. Download Ojdbc6.jar to #solr_home/contrib/dataimporthandler/, I downloaded it in Http://vdisk.weibo.com/s/z8ZZMoqsgpNFH
6. Under #solr_home/server/solr/mjd/conf, create a new file Data-config.xml, open, copy the following configuration
<dataConfig> <datasource driver="Oracle.jdbc.driver.OracleDriver"Url="jdbc:oracle:thin:@192.168.2.218:1521:product"User="Database user name"password="Database Password"/> <document name= "Product" pk= "PRIMARY Key" > <entity name="Bless"query="select * FROM Bless"<--here with query statements--Deltaimportquery="SELECT * from userinfo where userid= ' ${dih.delta.spuid} '"Deltaquery="Select bless_id from bless where Bless_time > ' ${dataimporter.last_index_time} '"><--here with an incremental query statement, ${dataimporter.last_index_time} indicates the last update time-</entity> </document></dataconf Ig>
7. Go to the Web Management page localhost:8983/solr/#, click on the core Admin menu, click Addcore, set name and Instancedir to the new folder name just before we first step
8. Under the dish thread dump there is a drop-down box, select the newly created core, click on the Add Field menu in the schema, name enter a field in the query statement you just configured (assuming the field is a string type), click Field Type, select Text_ Gerneral, click the Add button below
9. Go to the left menu, select DataImport, click on the Execute menu
10. Go back to the left menu, select query, click Execute Query, if the right side of the query data, the project has been configured successfully
You can continue to add the fields you want according to the eighth step, repeat 9 10 steps;
Resources:
Https://www.cnblogs.com/LUA123/p/7783102.html
Http://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-7.0.pdf
SOLR7 using Oracle Data Source to import + Chinese word breakers