Item10934: Add option to search subwebs via the WebSearch UI
Priority: Enhancement
Current State: Closed
Released In: 1.1.4
Target Release: patch
Applies To: Engine
Component:
Branches:
Add option to search subwebs via the WebSearch UI
There is currently no option under the advanced search foswiki UI to include all subwebs of a web in the search (the closest option is a search across all webs).
Paul Harvey (irc: pharvey) has investigated and found a way to add this functionality by modifying the default:
System/WebSearch page.
This modification adds a "Subwebs" checkbox below the "all public webs" checkbox.
The page content that adds this option can be found at:
http://foswiki.org/Sandbox/WebSearchRecurse?raw=on
Paul thinks this feature can probably be added safely to the upcoming foswiki release 1.1.4.
A diff of the new System/WebSearch content vs the current (1.1.3) page is:
53c53
< %STARTSECTION{"searchparamssimple"}%search=%URLPARAM{"search" encode="url"}%;scope=%URLPARAM{"scope" encode="url" default="all"}%;web=%URLPARAM{"web" encode="url"}%%ENDSECTION{"searchparamssimple"}%
---
> %STARTSECTION{"searchparamssimple"}%search=%URLPARAM{"search" encode="url"}%;scope=%URLPARAM{"scope" encode="url" default="all"}%;web=%URLPARAM{"web" encode="url"}%;recurse=%URLPARAM{"recurse" encode="url"}%%ENDSECTION{"searchparamssimple"}%
78a79,80
>
> <input type="checkbox" class="foswikiCheckbox" id="recurse" name="recurse" value="on" %IF{" '%URLPARAM{recurse}%' = 'on'" then="checked=\"checked\"" else=""}% /><label for="recurse"> %MAKETEXT{"Subwebs"}%</label>
92a95,96
>
> <input type="checkbox" class="foswikiCheckbox" id="recurse" name="recurse" value="on" %IF{" '%URLPARAM{recurse}%' = 'on'" then="checked=\"checked\"" else=""}% /><label for="recurse"> %MAKETEXT{"Subwebs"}%</label>
148a153,156
> %IF{
> "{EnableHierarchicalWebs}"
> then="recurse=\"$percntURLPARAM{\"recurse\" default=\"off\"}$percnt\""
> }%
155c163
< %STARTSECTION{"searchfeedlink"}% <a href='%SCRIPTURL{"view"}%/%BASEWEB%/WebRss?search=%URLPARAM{"search" encode="url"}%;type=%IF{"'%URLPARAM{"regex"}%'='on' OR '%URLPARAM{"type"}%'='regex'" then="regex" else="word"}%;excludetopic=%URLPARAM{"excludetopic" encode="url" default="%TOPIC%,WebHome,WebStatistics"}%;web=%URLPARAM{"web" encode="url" default="%BASEWEB%"}%;limit=%URLPARAM{"limit" encode="url" default="all"}%;scope=%URLPARAM{"scope" encode="url" default="text"}%;casesensitive=%URLPARAM{"casesensitive" encode="url" default="off"}%'>%MAKETEXT{"Get notified on changes on this search"}%</a>%ENDSECTION{"searchfeedlink"}%
---
> %STARTSECTION{"searchfeedlink"}% <a href='%SCRIPTURL{"view"}%/%BASEWEB%/WebRss?search=%URLPARAM{"search" encode="url"}%;type=%IF{"'%URLPARAM{"regex"}%'='on' OR '%URLPARAM{"type"}%'='regex'" then="regex" else="word"}%;excludetopic=%URLPARAM{"excludetopic" encode="url" default="%TOPIC%,WebHome,WebStatistics"}%;web=%URLPARAM{"web" encode="url" default="%BASEWEB%"}%;recurse=%URLPARAM{"recurse" encode="url" default="off"}%;limit=%URLPARAM{"limit" encode="url" default="all"}%;scope=%URLPARAM{"scope" encode="url" default="text"}%;casesensitive=%URLPARAM{"casesensitive" encode="url" default="off"}%'>%MAKETEXT{"Get notified on changes on this search"}%</a>%ENDSECTION{"searchfeedlink"}%
167c175
< %IF{"defined scope" then=" scope=\"%URLPARAM{"scope" encode="quote"}%\"$n"}%%IF{"defined web" then=" web=\"%URLPARAM{"web" encode="quote"}%\"$n"}%%IF{"defined nosearch" then=" nosearch=\"%URLPARAM{"nosearch" encode="quote"}%\"$n"}%%IF{"defined casesensitive" then=" casesensitive=\"%URLPARAM{"casesensitive" encode="quote"}%\"$n"}%%IF{"defined nosummary" then=" nosummary=\"%URLPARAM{"nosummary" encode="quote"}%\"$n"}%%IF{"defined nototal" then=" nototal=\"%URLPARAM{"nototal" encode="quote"}%\"$n"}%%IF{"defined order" then=" order=\"%URLPARAM{"order" encode="quote"}%\"$n"}%%IF{"defined reverse" then=" reverse=\"%URLPARAM{"reverse" encode="quote"}%\"$n"}%%IF{"defined limit" then=" limit=\"%URLPARAM{"limit" encode="quote"}%\"$n"}% zeroresults="%IF{ "defined search" then="on" else="off" }%"
---
> %IF{"defined scope" then=" scope=\"%URLPARAM{"scope" encode="quote"}%\"$n"}%%IF{"defined web" then=" web=\"%URLPARAM{"web" encode="quote"}%\"$n"}%%IF{"defined recurse" then=" recurse=\"%URLPARAM{"recurse" encode="quote"}%\"$n"}%%IF{"defined nosearch" then=" nosearch=\"%URLPARAM{"nosearch" encode="quote"}%\"$n"}%%IF{"defined casesensitive" then=" casesensitive=\"%URLPARAM{"casesensitive" encode="quote"}%\"$n"}%%IF{"defined nosummary" then=" nosummary=\"%URLPARAM{"nosummary" encode="quote"}%\"$n"}%%IF{"defined nototal" then=" nototal=\"%URLPARAM{"nototal" encode="quote"}%\"$n"}%%IF{"defined order" then=" order=\"%URLPARAM{"order" encode="quote"}%\"$n"}%%IF{"defined reverse" then=" reverse=\"%URLPARAM{"reverse" encode="quote"}%\"$n"}%%IF{"defined limit" then=" limit=\"%URLPARAM{"limit" encode="quote"}%\"$n"}% zeroresults="%IF{ "defined search" then="on" else="off" }%"
216a225
Thanks Ivor!
--
PaulHarvey - 30 Jun 2011
Argh, my trunk checkins aren't checking for EnableHierarchicalWebs (yet)
--
PaulHarvey - 30 Jun 2011
Shouldn't this be on by default?
--
ArthurClemens - 30 Jun 2011
I really don't know. Probably? Depends how your wiki is structured, I guess. YetAnotherPreferenceSetting?
--
PaulHarvey - 01 Jul 2011
Given that we weren't searching subwebs at all (before, not even in 1.0) I've left it default to off.
Feel free to fix it if you think it's a good idea (I don't feel like making that decision by myself today
--
PaulHarvey - 01 Jul 2011
Set as enhancement again, this should really be a bug, but it's existed for a long time (no subweb option in Release01x00 anyway)
--
PaulHarvey - 01 Jul 2011
Why would you have subwebs if there is no relationship between the parent web and child webs? "Don't make me think", and just search those subwebs. And check out if you want less noise.
--
ArthurClemens - 01 Jul 2011
The way our corporate foswiki content is structured it would be best if subwebs are searched by default. In general I think this makes the most sense when dealing with top-down hierarchies.
On the other hand a change to a default like this in a dot release could potentially be dangerous (I'm not sure). A site-wide preference setting for this option would be great.
--
IvorBlockley - 04 Jul 2011
If we default to searching subwebs, it definitely needs a new preference setting. Without Solr or MongoDB, my users would just see fcgid timeouts on some webs.
--
PaulHarvey - 04 Jul 2011
were you able to get this updated? If so how do I go about loading the code on to my Main Web page?
--
MatthewGonter - 30 Jun 2014