For indexes with a large amount of data (index files larger than 50 MB), do not sort the index fields by index ID (indexorder). The efficiency of the two indexes is nearly 10 times different, the following compares the memory usage with the CPU processing time:
Memory usage comparison:
Figure 1: Sort data by unique ID fields of an integer type
Figure 2: sort by index ID (indexorder)
Compare the objects that occupy the most memory: we can see that figure 1 shows 2,900,766 bytes more than figure 2 (index file size: 61 m)
Processing time comparison:
The processing time for sorting a field with the unique identifier of an integer is 3016 ms, and the sorting time using the index ID (indexorder) is 303 Ms.
Solution:
In order to ensure that the reverse order of index IDS is equivalent to the reverse order of time: When an index is created, it must be created according to the time sequence of the data. Old data is first indexed, and new data is then indexed.
Reverse code:
// The following code is based on Incubating-Apache-Lucene.Net-2.0-004-11Mar07
Hits hits = searcher. Search (query, new sort (New sortfield (null, sortfield. Doc, true )));
Reference: http://markmail.org/message/noq4kohwipx5wzfo#query:Sort.INDEXORDER+page:1+mid:4ydkfgdj6kbvhq2x+state:results