Recent Changes - Search:

add Cookbook page







Visitor's book Site map pmwiki-2.3.30

Search Cloud

Summary: Creates a list of search terms used on a PmWiki site.
Version: 2022-12-01
Prerequisites: PHP 8.0
Status: stable
Maintainer: CarlosAB? skiwi
Categories: Searching


Questions answered by this recipe

How can I see a list of the search terms used on my site?


This script makes a tag like list of the search terms used on your site. Using the directive (:searchcloud:), you'll see a list of the search terms used on your site. The most used terms will look bigger in the list.


To install this script, download searchcloud-2022-12-01.php, copy it into your cookbook/ subdirectory, rename it as searchcloud.php, and add the line


to your local/config.php file.



Without parameters the search cloud is displayed, increasing font size and font-weight based on the search term frequency.

(:searchcloud list=name:)

Lists search terms in ascending alphabetical order, with no additional formatting

(:searchcloud list=count:)

Lists search terms in ascending frequency order, with no additional formatting

Config file options

Default values are shown.

$SearchCloudFileName = '.searchcloud'; # the filename used for storage, placed in the folder set by $WorkDir which defaults to wiki.d
$EnableSearchCloudClean = true; # "true" removes the file used for storage, using action ?action=clearcloud
$SearchCloudMinCount = 5; # minimum percentage count displayed
$SearchCloudMaxSize = 100; # maximum count for size and font weight
$SearchCloudBaseFont = 9; # base starting font size in pixels
$SearchCloudBaseWeight = 400; # base starting font weight


The 2022 version has been largely rewritten, see the release notes.

Search terms are saved after being converted to a canonical form, which amongst other things:

  • coverts text to lower case
  • removes leading and trailing non-alphanumeric characters

A number of terms are saved, but not displayed, e.g.

  • excludes terms with prefixes such as "list=", "group=", "trail=", "link=", "category=", and "name="
  • excludes search terms that do not contain a Unicode alphanumeric character

This recipe does not (yet) handle Unicode correctly.
It is likely the recipe will work best if:

Release Notes

  • 2022-11-11 Canonical term truncated leading and trailing symbols, retaining embedded symbols
  • 2022-10-10 Exclude link= etc, add min display percentage, limit max display size and font weight, term must include at least one unicode letter
Replace Markup_e with MarkupDirectiveFunctions, search terms case insensitive, add list parameter, add mouseover, fix initialisation bugs


Where can I see an example?


See Also


CarlosAB? March 27, 2006, at 03:50 PM
skiwi 2022

tahi Page last modified on 2022 Dec 09 18:37

Edit - History - Recent Changes - WikiHelp - Search - email page as link -> mailto:?Subject="KiwiWiki: Search Cloud"&Body=