version=pmwiki-2.2.44 ordered=1 urlencoded=1 author=RDJones charset=UTF-8 csum=Corrected typo ctime=1150411168 description=A page for advanced and customized search options name=PmWiki.Search rev=130 targets=PmWiki.WikiTrails,PmWiki.PageLists,Site.PageListTemplates,Site.LocalTemplates,Cookbook.PagelistTemplateSamples,Cookbook.Cookbook,PmWiki.Search,Site.AllRecentChanges,PITS.PITS,Group.Name text=(:description A page for advanced and customized search options:)%0a(:Summary:Targeting and customising search results:)%0a(:if !equal {$Action} "search":)%0a>>rframe width=300pcx font-size=smaller%3c%3c%0a-%3c '''This page uses [[#example|custom]] searches.'''%0aFor regular searches, view another page.%0a>>%3c%3c%0aPmWiki provides a basic search function. While it is not powered by a "search engine", it can be tweaked to produce results that are ''targeted'' and ''customized.'' %0a%0a!!!! Targeted searches%0aSearches can be targeted to restrict the search to certain pages. For example, a search can be restricted based on groups, where, for instance, "group=PmWiki" searches only the PmWiki group, and "group=-PmWiki" searches only pages that are not in the PmWiki group. In addition to groups, searches can be restricted based on page names ("name="), [[wiki trails]] ("trail="), backlinks ("link=") and other criteria (e.g. "list=normal") and capped at a maximum number ("count="). For documentation about each of these parameters, see [[page lists]]. %0a%0a!!!! Customized display%0aThe display of search results can be customized to control the format, content and order of the returned results. %0a:fmt=: select format and content by specifying a pagelist template that determines layout, such as list styles, and page elements, such as title and description. %0a:order=: allows results to be sorted according to different criteria, such as name and title. For documentation about each of these parameters, see [[page lists]]. %0aFor examples of pagelist template formats see [[Site.Page List Templates]], (:if2 exists Site.LocalTemplates:)[[Site.Local Templates]],(:if2end:) and [[Cookbook:Pagelist Template Samples]].%0a%0aThe [@(:pagelist request=1 req=1:)@] directives can be used instead of [@(:searchresults:)@] to remove the "Results of search for" message.%0aNeither of these directives work for the [@(:searchresults:)@] or [@(:searchbox:)@] directives.%0a:req=1: disables the pagelist until search results are returned.%0a:request=1: see [[PmWiki/PageLists#pagelistrequest|pagelists]]%0aThis can be used in many more cases than the default pmwiki search. %0aData from pages with PTVs, etc can be searched, filtered, and reordered.%0aNote that the default ordering is of text strings, ie. 1, 10, 2, 3 and not the numeric value 1, 2, 3, 10, but a custom pagelist sort function (see the [[cookbook/]]) can return any order required.%0a%0a!!!! Anyone, anywhere%0a'''Readers''' can create targeted and customized search results simply by typing the relevant parameters , e.g. "group=PmWiki", into search boxes together with their search string. '''Authors''' can predefine such targeted and customized searches by incorporating the parameters into pages using the [@(:searchbox:)@] and [@(:searchresults:)@] directives (documented at [[PageLists]]).%0a%0a[@(:searchresults:)@] can be customized by editing page [@Site.Search@].%0a%0aSee also%0a* $PageSearchForm %0a* $SearchBoxOpt%0a* $SearchPatterns%0a%0a%0a[[#example]]%0a!!!!Try it: this page generates custom searches%0aAny search that is run from this page will automatically generate pre-defined sets of search results that: '''''target''''' different clusters of pages (documentation, cookbook and PITS, if available); use '''''customized''''' formats, content and ordering; and '''''reveal''''' the specific parameters used to generate each search result. Whether you use the search box below, or the regular search box that appears at the top of this page, any search that you run from this page will provide the customized results. %0a(:searchbox size=20:)%0a%0a%0a(:ifend:)%0a(:if equal {$Action} "search":)%0a[[{$Name}|back]]\%0a%0a(:table border=0 width=100%25:)\%0a%0a(:cell width=30%25:)\%0a%0a!!!! [[Site/AllRecentChanges?q=PmWiki/+order%253Dname&action=search|All Documentation]]%0a(:searchresults group=PmWiki fmt=#onegroupdesc order=name:)%0a(:if expr exists Cookbook.Cookbook and equal {$Action} "search":)%0a(:cell width=35%25:)\%0a%0a!!!! [[Cookbook.Cookbook|All Cookbook Recipes]]%0a(:searchresults group=Cookbook fmt=#summary order=name:)%0a(:if expr exists PITS.PITS and equal {$Action} "search":)%0a(:cell width=35%25:)\%0a%0a!!!! [[PITS.PITS|PITS (Issue Tracking)]]%0a(:searchresults group=PITS fmt=#summary name=0* order=-name:)%0a(:if equal {$Action} "search":)%0a(:tableend:)%0a%0aNote: The strings that were used to target and format each search result are shown above in ''italics'' and can be entered directly into a regular search box.%0a%0a(:title Search:)%0a(:if false:)%0a%0a[[#onegroupdesc]]%0a[[{=$Group}/{=$Name}]] %25font-size=smaller font-style=italic%25{=$Description}%25%25\\%0a[[#onegroupdescend]]%0a%0a[[#summary]]%0a[[{=$Group}/{=$Name}]] %25font-size=smaller font-style=italic%25{=$:Summary}%25%25\\%0a[[#summaryend]]%0a(:ifend:) time=1354209958 title=Search