Notes for re-Indexing in solr and. net series (8) solr,. netsolr

Source: Internet
Author: User

Notes for re-Indexing in solr and. net series (8) solr,. netsolr

Notes for re-Indexing in solr and. net series (8) solr

If solr is used in the project, it is definitely to run the data in the database into the solr server. solr has two operations: Creating an index and incremental indexing, here we will talk about the precautions for creating an index.

Stop running index http: // 192.168.0.9: 8080/solr/collection1/dataimport? Command = abort

Start indexing http: // 192.168.0.9: 8080/solr/collection1/dataimport? Command = full-import

When we execute an index for the first time, because there is no data in solr, everything will happen according to our imagination. But when we need to re-execute the index, we will execute the above link, there will be a problem where all the data in solr disappears during execution and then increases a little bit. This is definitely not acceptable, because when the data volume is large, it takes a long time to execute an index. When a user logs on to your system, you will find that your data is insufficient and there will be problems. Data will be complete only when the execution is complete, this is because solr uses the default mechanism to remove all existing data first (in fact, it is transferred to another location. When the index is deleted, it will be rolled back if the index is abnormal ), then we can run it in a batch, but we can choose to re-run the index without removing the data, but overwrite the original data one by one, so that the user will not be affected, however, it will increase the index time,

The execution statement is http: // 192.168.0.9: 8080/solr/collection1/dataimport? Command = full-import & clean = false

Perform the following operations on the GUI:

Then let's talk about the problem of multi-Table Indexing. When our data is obtained from multiple tables

<dataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://192.168.0.9;DatabaseName=test" user="sa" password="123"/>    <document name="Info">        <entity name=" 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}'">                              <field column="id"      name="id"      />                      <field column="name"      name="solrname"      />                      <field column="address "      name=“address "      />                      <field column="phone "      name="phone "      />                     <field column="class "      name="class "      />                      <field column="addtime "      name="addtime "      />          </entity><entity name=" 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}'">                              <field column="id"      name="id"      />                      <field column="name"      name="solrname"      />                      <field column="address "      name=“address "      />                      <field column="phone "      name="phone "      />                     <field column="class "      name="class "      />                      <field column="addtime "      name="addtime "      />          </entity>    </document>    </dataConfig>

This data source obtains data from tableA and tableB. Of course, the IDs of the two tables cannot be the same; otherwise, the incoming data will overwrite the first data, so what if we only 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 (both tables will re-run), in fact solr can be a single index based on the name of the entity, the data of other tables will not change

The method is as follows:

Http: // 192.168.0.9: 8080/solr/collection1/dataimport? Entity = test1 & command = full-import, of course, you can add clean = false,

Graphic Interface operation method:

Related Article

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.