SearchResultsPageList

test a search results PageList based on a Page List Template

This test page looks at issues with the #searchresults pagelist defined below

  • why does the pagelist return values even before the search?
  • why, when the searchbox is used does the page not show the #searchresults pagelist?
  • from a similar example here where {$$PageListCount} is not showing
(:searchbox target={$FullName} :)
>>comment<<
[[#searchresults]]
(:template defaults request=-group req=1 order=$Name name={$:ExcludePages} list=normal:)
(:template first:)
----
!!! [[{$$group}/ | {$$fromgrp}]]
(:details summary="Show {$$PageListCount} search results from {$$fromgrp}":)
(:template each:)
(:if equal "{=$Title}" "Home Page":)
* [[{=$FullName} | {=$Groupspaced}]] [-&nbsp;{=$:Summary}-] [--(E={$$EachCount} P={$$PageCount} G={$$GroupCount} GP={$$GroupPageCount} PL={$$PageListCount})--]
(:else:)
* [[{=$FullName} | {=$Titlespaced}]] [-&nbsp;{=$:Summary}-] [--(E={$$EachCount} P={$$PageCount} G={$$GroupCount} GP={$$GroupPageCount} PL={$$PageListCount})--]
(:ifend:)
(:template last:)
(:detailsend:)
(:template none:)
No results found
[[#searchresultsend]]
>><<

(:template defaults request=-group req=1 order=$Name name= list=normal:) (:template first:)


{$$fromgrp}

Show {$$PageListCount} search results from {$$fromgrp}

(:template each:)

  • {=$Titlespaced}  {=$:Summary} (E={$$EachCount} P={$$PageCount} G={$$GroupCount} GP={$$GroupPageCount} PL={$$PageListCount})

(:template last:)

(:template none:) No results found

(:pagelist group=PmWiki fmt=#searchresults fromgrp="the PM wiki pages" count=10:)

the PM wiki pages

Show 311 search results from the PM wiki pages
  • Access Keys  Access keys are keyboard shortcuts for tasks that would otherwise require a mouse (E=1 P=1 G=1 GP=1 PL=311)
  • Access Keys-Talk  Discussion of AccessKeys (E=2 P=2 G=1 GP=2 PL=311)
  • Analyze Results  Instructions and possible responses from using the Site Analyzer (E=3 P=3 G=1 GP=3 PL=311)
  • Answered Questions (AQ)  Repository for questions about PmWiki that have been answered, see also FAQ (E=4 P=4 G=1 GP=4 PL=311)
  • Audiences  Patrick Michaud's comments regarding the "audiences" for which PmWiki was designed (E=5 P=5 G=1 GP=5 PL=311)
  • Authoring Philosophy  Patrick Michaud on the reasons behind Author variables (E=6 P=6 G=1 GP=6 PL=311)
  • Author Tracking-Talk   (E=7 P=7 G=1 GP=7 PL=311)
  • Auth User  Authorization system that uses usernames and passwords (E=8 P=8 G=1 GP=8 PL=311)
  • Auth User-Talk  Discussion of AuthUser (E=9 P=9 G=1 GP=9 PL=311)
  • Available Actions  All PmWiki page actions (?action=) and other query parameters (E=10 P=10 G=1 GP=10 PL=311)

req=1

The req=1 parameter requires that search terms be posted (that is, that the user presses "search" on a search form, or follows a link with additional parameters like [[Page?q=terms&order=-name]]) before the pagelist is executed. Note that (:pagelist request=1 req=1:) works mostly like (:searchresults:) without the lines "Results of search for ..." and "X pages found out of Y pages searched". Both "request=1" and "req=1" are needed.

When a search is performed, either via a searchbox directive, or via the search form of the skin, if the page contains a "searchresults" directive, that page will be used to display the results of the search; if the page doesn't have a "searchresults" directive, the page Site.Search will be used to display the results.

request=

With (:pagelist [other parameters] request=1:) you can override most pagelist parameters, by providing request parameters in the URL. For example, (:pagelist order=name request=1:) will normally sort the list by name. But if the page's URL contains ?order=time, the list will be sorted by time. If the URL contains ?order=, the list will be unordered. Note: In the URL, encode any "#"s that are in your parameters as "%23". Since this parameter gives users who don't have edit rights the ability to run a pagelist of their choosing, consider its security implications for your website before using it.

Since version 2.2.71, it is possible to explicitly allow only certain parameters that can be overridden, or to disallow some parameters to be overridden. If you need this, instead of 1, enter the parameter names.

Allow all parameters to be overridden:
(:pagelist request=1:)
Allow only 'order' and 'count' parameters to be overridden:
(:pagelist request=order,count:)
Allow all parameters to be overridden, except 'fmt' and 'trail', note the "minus" sign before each forbidden parameter:
(:pagelist request=-fmt,-trail:)
 0: 00.00 00.00 EnablePost = 1, keys=
 1: 00.00 00.00 config start
 2: 00.01 00.01 config end
 3: 00.03 00.03 MarkupToHTML begin
 4: 00.03 00.03 MarkupToHTML begin
 5: 00.04 00.04 MarkupToHTML end
 6: 00.04 00.04 MarkupToHTML begin
 7: 00.06 00.06 MarkupToHTML end
 8: 00.06 00.06 MarkupToHTML begin
 9: 00.06 00.06 FPLTemplate: Chain begin
10: 00.06 00.06 FPLTemplate: FPLTemplateLoad
11: 00.06 00.06 FPLTemplate: FPLTemplateDefaults
12: 00.06 00.06 FPLTemplate: FPLTemplatePageList
13: 00.06 00.06 MakePageList pre
14: 00.06 00.06 PageListSources begin
15: 00.06 00.06 PageStore::ls begin wiki.d/{$FullName}
16: 00.07 00.06 PageStore::ls merge wiki.d/{$FullName}
17: 00.07 00.07 PageStore::ls end wiki.d/{$FullName}
18: 00.07 00.07 PageStore::ls begin $FarmD/wikilib.d/{$FullName}
19: 00.07 00.07 PageStore::ls merge $FarmD/wikilib.d/{$FullName}
20: 00.07 00.07 PageStore::ls end $FarmD/wikilib.d/{$FullName}
21: 00.07 00.07 PageListSources end count=311
22: 00.07 00.07 PageListSort pre ret=4 order=$Name
23: 00.07 00.07 MakePageList items count=311, filters=
24: 00.07 00.07 MakePageList post count=311, readc=0
25: 00.07 00.07 PageListSort begin
26: 00.08 00.07 PageListSort sort
27: 00.08 00.07 PageListSort end
28: 00.08 00.07 MakePageList end
29: 00.08 00.07 FPLTemplate: FPLTemplatePmWikiOrg
30: 00.08 00.07 MarkupToHTML begin
31: 00.08 00.07 MarkupToHTML end
32: 00.08 00.07 FPLTemplate: FPLTemplateSliceList
33: 00.08 00.07 FPLTemplate: FPLTemplateFormat
34: 00.09 00.09 MarkupToHTML begin
35: 00.11 00.10 MarkupToHTML end
36: 00.11 00.10 FPLTemplate: FPLTemplatePmWikiOrgPostFormat
37: 00.11 00.10 FPLTemplate: Chain end
38: 00.11 00.10 MarkupToHTML end
39: 00.11 00.10 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
40: 00.12 00.11 ReadApprovedUrls SiteAdmin.ApprovedUrls end
41: 00.14 00.13 MarkupToHTML end
42: 00.15 00.13 MarkupToHTML begin
43: 00.16 00.14 MarkupToHTML end
44: 00.16 00.14 MarkupToHTML begin
45: 00.16 00.15 MarkupToHTML end
46: 00.16 00.15 now
Peak memory: 5,657,600 bytes