Previously, I talked about the process of adding a term to the posting table. Next I will talk about the process of writing the posting table to a file.
I am not very careful with this content. I will try to extend it in detail later.FootprintsHere
Preparations:
These six steps are preparations before writing. When indexwriter is called. after the close () process, the write starts. 6th) Step 1 is to create a segment index. The next step is:
This ordered call makes the posting tables in multiple threads and documents merged. These methods are very important. Please read them in detail, this layer-by-layer calling relationship is similar to Google map. From the perspective of the universe, you can see nothing clearly. To know the details, you have to go deep into the street level and give a book to you, if you only see the cover, you cannot write your reading experience. You can open it one page at a time.
The figure above shows this process. It makes sense to open every page and write the data. I will not draw any picture and directly copy the Lucene comment:
Current writer chain:
Formatpostingsfieldsconsumer
-> Impl: formatpostingsfieldswriter
-> Formatpostingstermsconsumer
-> Impl: formatpostingstermswriter
-> Formatpostingsdocconsumer
-> Impl: formatpostingsdocwriter
-> Formatpostingspositionsconsumer
-> Impl: formatpostingspositionswriter
Here is the class that is really responsible for writing. initialize and call the method in 10). You can read it in depth.
(This section is relatively hasty, and I hope to improve it later)
Next, I will explain how to retrieve files.