SOLR and. NET Series courses (eight) considerations for re-running indexes in SOLR

Source: Internet
Author: User
Tags solr

SOLR and. NET Series courses (eight) considerations for re-running indexes in SOLR

If we use SOLR in a project, it is necessary to run the data in the database into the SOLR server, there are two operations in SOLR, one is to create a new index, and one is an incremental index, here we say a new index note

Stop Run Index Http://192.168.0.9:8080/solr/collection1/dataimport?command=abort

Start Index Http://192.168.0.9:8080/solr/collection1/dataimport?command=full-import

When we first executed the index, because there was no data in SOLR, everything would have happened as we had imagined, but when we needed to re-execute the index, there was a problem with the link above, and when it was done, all the data in Solr disappeared, and then a little bit more, This is certainly not possible, because when the amount of data is very large, it takes a long time to perform an index, then the user log on your system will find that your data is not enough, will be a problem, only when the completion of the complete data will be completed, resulting in this reason is the SOLR default so the mechanism is to first remove all the original data ( is actually moved to another location, when the index is completed when the deletion, the index is the exception will be rolled back, and then run in a strip of the inside, but we can choose to re-run the index without removing the data, but instead of overwriting the original data, which will not affect the user, but will increase the index time,

Execution statement is Http://192.168.0.9:8080/solr/collection1/dataimport?command=full-import&clean=false

In the graphical interface, do the following:

And then we're talking about multiple table index problems when our data is obtained from multiple tables, as follows

<DataSourceDriver= "Com.microsoft.sqlserver.jdbc.SQLServerDriver"URL= "Jdbc:sqlserver://192.168.0.9;databasename=test"User= "sa"Password= "123"/>    <Documentname= "Info">        <Entityname= "Test1"Transformer= "Clobtransformer"PK= "id"Query= "SELECT ID, name address,phone,class,addtime from TableA"Deltaimportquery= "SELECT ID, name address,phone,class,addtime from TableA"Deltaquery= "SELECT id from TableA where adddate > ' ${dataimporter.last_index_time} '">                              <Fieldcolumn= "id"name= "id"      />                      <Fieldcolumn= "Name"name= "Solrname"      />                      <Fieldcolumn= "Address"name= "Address"      />                      <Fieldcolumn= "Phone"name= "Phone"      />                     <Fieldcolumn= "Class"name= "Class"      />                      <Fieldcolumn= "Addtime"name= "Addtime"      />          </Entity><Entityname= "Test2"Transformer= "Clobtransformer"PK= "id"Query= "SELECT ID, name address,phone,class,addtime from TableB"Deltaimportquery= "SELECT ID, name address,phone,class,addtime from TableB"Deltaquery= "SELECT id from TableB where adddate > ' ${dataimporter.last_index_time} '">                              <Fieldcolumn= "id"name= "id"      />                      <Fieldcolumn= "Name"name= "Solrname"      />                      <Fieldcolumn= "Address"name= "Address"      />                      <Fieldcolumn= "Phone"name= "Phone"      />                     <Fieldcolumn= "Class"name= "Class"      />                      <Fieldcolumn= "Addtime"name= "Addtime"      />          </Entity>    </Document>    </Dataconfig>

This data source is to get the data from TableA and TableB, of course, the ID of the two tables cannot be duplicated, otherwise the incoming data will overwrite the first entry, then when we just want to re-index one of the tables,

Http://192.168.0.9:8080/solr/collection1/dataimport?command=full-import, this statement will re-run all the data (two of the table will be re-run), In fact SOLR is a single index that can be based on the name of entity, the data of other tables is unchanged

Here's how:

Http://192.168.0.9:8080/solr/collection1/dataimport?entity=test1&command=full-import, of course, can also add Clean=false,

Graphical interface operation mode:

SOLR and. NET Series courses (eight) considerations for re-running indexes in SOLR

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.