Open-CSP / WikiSearchFront

Front-end for the WikiSearch extension.
GNU General Public License v2.0
3 stars 6 forks source link

Honor fulltext=1 ? (redirect on titles when the term matches) #21

Open bertrandgorge opened 3 months ago

bertrandgorge commented 3 months ago

Hello all,

I have an issue when using WikiSearch and the default MW autosuggest feature.

As it comes, the autosuggest feature builds a list like this one:

<div class="suggestions" style="font-size: 30px; position: absolute; inset: 164px auto auto 651.5px; width: 559px; height: auto; display: none;">
<div class="suggestions-results">
    <a href="/index.php?title=Search&amp;term=TCA&amp;profile=default" title="TCA" class="mw-searchSuggest-link"><div class="suggestions-result" rel="0"><span class="highlight">TC</span>A</div></a>
    <a href="/index.php?title=Search&amp;term=TCO&amp;profile=default" title="TCO" class="mw-searchSuggest-link"><div class="suggestions-result" rel="1"><span class="highlight">TC</span>O</div></a>
    <a href="/index.php?title=Search&amp;term=TCO%20en%20grande%20culture%2C%20par%20Emeric%20Saboureau&amp;profile=default" title="TCO en grande culture, par Emeric Saboureau" class="mw-searchSuggest-link"><div class="suggestions-result" rel="2"><span class="highlight">TC</span>O en grande culture, par Emeric Saboureau</div></a>
    <a href="/index.php?title=Search&amp;term=TCS&amp;profile=default" title="TCS" class="mw-searchSuggest-link"><div class="suggestions-result" rel="3"><span class="highlight">TC</span>S</div></a>
    <a href="/index.php?title=Search&amp;term=TCSL&amp;profile=default" title="TCSL" class="mw-searchSuggest-link"><div class="suggestions-result" rel="4"><span class="highlight">TC</span>SL</div></a>
</div>

<a href="/index.php?title=Search&amp;term=TC&amp;profile=default&amp;fulltext=1" class="mw-searchSuggest-link">
    <div class="suggestions-special" style="display: block;"><div class="special-label">Rechercher les pages contenant</div><div class="special-query">TC</div></div>
</a>
</div>

The first links are actual pages from the wiki, and the last link is supposed to bring you to the search page for more results and advanced search. The difference between the first links and the last is the presence of fulltext=1.

It would be super cool if WikiSearchFront could follow the search behaviour of other MW setups, which is that the search page must redirect to the title when the search term matches one, unless the fulltext=1 is passed in...