On 8/4/2021 1:24 AM, Vincent Brillault wrote:
On a local dovecot cluster currently hosting roughly 2.1TB of data, using Solr as its FTS backend, we now have 256GB of data in Solr, split in 12 shard (to which replication adds 256GB of data through 12 additional cores).
I'm now trying to see if we can optimize that data. Looking at one core at random (22G), I see that the data is split mostly between
- .pos files: 12G
- .tim files: 4.2G
- .doc files: 3.8G
- .cfs files: 1.8G
Looking around a bit, I found https://lucene.apache.org/core/6_2_0/core/org/apache/lucene/codecs/lucene50/... (which is unfortunately a bit outdated I think) that explains each file content:
- .tim: Term Dictionary
- .tip: Term Index
- .doc: Frequencies and Skip Data
- .pos: Positions
- .pay: Payloads and Offsets
This is completely off-topic for the dovecot list. I am involved with the Solr project, so I can discuss it. My message will also be off topic here.
You didn't say what version of Solr you're on. That document for Lucene 6.2.0 would be relevant for Solr 6.2.0. There are versions of that document for all Lucene releases, which have been in lock-step with Solr releases since one of the early 3.x versions. (Aside: Solr has been split into its own top-level Apache project, so there is no longer a guarantee moving forward that Solr X.Y.Z will be based on Lucene X.Y.Z)
Not all of the lucene file types will be involved on every install of Solr. It will depend on the configuration.
The .cfs file is a file where all of the other file types for a segment are compounded into a single file. Within that single file, each file type will use the same format as it would if it had its own extension. I'm not completely clear on when Lucene (under Solr's control) will choose the CFS format .. but I think it happens when the segments are small, not large.
Looking at Solr documentation on search (https://solr.apache.org/guide/8_6/the-standard-query-parser.html) it seems that position aware query are written as
"term1 term2"~[0-9]+
. Looking at the dovecot code (https://github.com/dovecot/core/blob/master/src/plugins/fts-solr/fts-backend...), I don't see this kind of query being made,~
only being used for fuzzy search.
Positions are required for a phrase query -- where the query text is in double quotes. The number after ~ on a phrase query refers to phrase slop -- think of it as a fuzziness factor for the phrase, not for each term. Right now you noticed that dovecot's FTS Solr plugin doesn't explicitly use phrase queries, but there's no guarantee that this will always be the case. Position data will only be accessed if it is needed for a query, so if it is not needed it should not affect query performance. I cannot speak as to whether the FTS Solr plugin relies on the autoGenereatePhraseQueries functionality, but if it does, then you definitely want position data in the index. That functionality can do a lot to improve relevancy ranking, so I would expect it to be instrumental in good full-text searching -- disabling positions will probably not help your search results.
If you want an in-depth discussion beyond this email, please subscribe to the solr-user mailing list and ask there.
Note that general Solr recommendations are to have enough space available that the Solr index can triple in size temporarily -- this is to accommodate all possible scenarios for Lucene segment merging. Running Solr on systems with limited disk space is not recommended.
Solr does have an "optimize" operation which will combine all the segments into one, removing space taken up by deleted documents as it works. Lucene calls that operation "forceMerge". Running an optimize can help performance, but it's extremely resource intensive and can take a long time to run -- performance gets worse before it gets better. Also, the amount of performance gain is not usually significant.
Thanks, Shawn