Today just after noon, the department manager to let me deal with a deployment project solr index and the actual data is not in conformity with the problem, our system in the main page with solr to load, two articles in the database is already deleted, and the system home page also in the show, I treated this problem several times before, So I checked the difference data between the database and SOLR with ease, and then restarted the main system (internal system of the company) on the server. According to the business of the system, the index should be updated after the system is started. After the launch, I checked the page and found that the two articles still existed (they still didn’t excite me that much), so I rebooted the Solr service and checked again. The solr service was so stubborn that I had to do what I always do: delete the index, which led to half the afternoon’s testiness.

As shown in the picture, I first went to Solr to have a look at the service, and found nothing abnormal, then I executed the delete index command

Again, how could I do this? What’s more, I didn’t have a backup.

After I deleted the index, I rebooted the service, and this time I confidently prepared to write my page, and then….. Then I went to solr’s Query, OMG, there was no index, but I didn’t panic, I believe the service was not good, I ran again and again, finally I resigned myself, see how to solve it.

After I asked the manager and director, I had to rely on myself. There was no solr on the Internet how to restore the index, but it was also backed up before. I made fun of my operation of deleting the database without backing up again. (PS: I often backup during daily development)

Because solr index data has a basis, fortunately we can also operate to add, so I submitted an article, I went to Solr to see its format, Its format is a JSON (if you want to operate directly, solr can execute it by typing the JSON into the JSON box of Documents). It looks like this:

But do not add version and checkUsed, that is self-generated.

Now that I know the format of the index, I will paste and copy it into Documents to test adding one

Ok, add success, now that we know the index format, we can go to the source data to regenerate, at this point I am very happy.

I’m going to delete this data, and this time I’m going to delete it the right way

<``delete><id>275bc7c6-7da3-410d-8d49-fe1461cd967b</id></delete``>

<commit/>

After deleting, I went to the database to find the fields corresponding to the index. After I collected all the fields painstakingly, I executed the output of them

According to the output data, I successfully displayed the new steps in the system. Then I found the problem again. There was no attachment, and I was really suffering.

I have added another scheme with attachments, but I give up the format, which is the following \n\n that I can’t understand

When I despair, I remember when we submit will create or update the index, so I put my own a program from the state of the database will not submit to resubmit, intermediate step is not to say, anyway in solr is again, though this is not so good, but this is the moment I’m the most convenient, If there are any gods who know how to restore please private message or comment, worship the lords.

Write this article to warn!