This question about Missing functionality: Answered

How can I make the AdvancedSearchForm respect my Site Preferences?

Default search type for my site is keyword search. But WebSearch always uses 'word' search by default, no matter what search preferences are. How can I make WebSearch respect site preferences?


Unfortunately there is no simple override for the default search type. You could modify the System.WebSearch topic, but you would lose your changes when upgrading to a new version. The better solution is to create your own version of WebSearch - for example, SiteSearch. Changes to make to the SiteSearch copy of System.WebSearch

In the following block, change the default word to keyword
%STARTSECTION{"searchparamsadvanced"}%%INCLUDE{"%TOPIC%" section="searchparamssimple"}%;type=%URLPARAM{"type" encode="url" default="keyword"}%;nosearch=%URLPARAM{"nosearch" encode="url"}%;limit=%URLPARAM{"limit" encode="url"}%;excludetopic=%URLPARAM{"excludetopic" encode="url"}%;casesensitive=%URLPARAM{"casesensitive" encode="url"}%%ENDSECTION{"searchparamsadvanced"}%

And down further in the optionsadvanced section, change the defaults of the two radio buttons. Remove the default="word" from the word button, and add default="keyword" to the keyword button. Note that you need to quote the "type" in the %URLPARAM macro.

<input type="radio" class="foswikiRadioButton" id="word" name="type" value="word" %IF{" '%URLPARAM{"type"}%' = 'word' " then="checked=\"checked\"" else=""}% /><label for="topic"> %MAKETEXT{"Word search"}%</label><br />
<input type="radio" class="foswikiRadioButton" id="keyword" name="type" value="keyword" %IF{" '%URLPARAM{"type" default="keyword"}%' = 'keyword' " then="checked=\"checked\"" else=""}% /><label for="topic"> %MAKETEXT{"Keyword search"}%</label><br />

I don't know if there is any easier way to accomplish this. None that I can see anyway.

-- GeorgeClark - 19 Apr 2011

Task Tasks.Item10658 opened. We are investigating fixing this and restoring the SEARCHDEFAULTTTYPE setting.

-- GeorgeClark - 20 Apr 2011
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads