QtHelp: Don't delete arbitrary files from the search index directory


The search index directory was derived from the collection file name
by stripping ".qhc" with left(lastIndexOf(".qhc")). Without the suffix
lastIndexOf() returns -1 and the whole name was used, so e.g. "~/ssh"
mapped onto "~/.ssh"; a file named ".qhc" mapped onto its own
directory. Writer::clearLegacyIndex() then removed every file in that
directory unless it contained "fts".

Remove clearLegacyIndex(). It was meant to clean up the old CLucene
index, which hasn't been used since 2015.

Only strip a real ".qhc" suffix, and fall back to
".<fileName>.fulltextsearch" when there is no suffix or the base name
is empty. Apply the same fix to the copy of the logic in Assistant.

Make Assistant's -remove-search-index delete only the "fts" database
instead of every file in the directory.

Fixes: QTBUG-150683
Pick-to: 6.12 6.8
Change-Id: Ib66c36d09dcac9385b7e6c8e6aa0d7b1ad689d36
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
commit337595afc9b1b3f105006fa0e3413ff82da1c2df
parent97e7ef77adc957a1e5387374cafe46ff78c6226a
authorJarek Kobus <jaroslaw.kobus@qt.io>
committerJarek Kobus <jaroslaw.kobus@qt.io>
commit timeThu, 1 Oct 2026 15:03:40 +0000