SearchCloud

Summary: Creates a list of search terms used on a PmWiki site.
Version: 20180319
Prerequisites: none
Status: beta
Maintainer: CarlosAB
Categories: Searching

Questions answered by this recipe

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

Description

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.

It has an option $EnableSearchCloudClean that when set to one on your config.php file, will let users clean up the file used for storage, using action ?action=clearsky .

The name of the file used for storage can be changed by putting the line $SearchCloudFile = "yournameofchoice"; inside your config file.

The file set by $SearchCloudFile, will be stored inside the folder set by $WorkDir which is now wiki.d.

Installation

To install this script, simply copy it into your cookbook/ subdirectory, and then add the line

include_once("$FarmD/cookbook/searchcloud.php");

to your local/config.php file.

In your wiki use tag: (:searchcloud:)

Notes

This is the first release and if you have any sugestions or corrections, please let me know.

Release Notes

 searchcloud-1.0.zipΔ

20180319 - Second version with solution and corrections to all the problems commented before - searchcloud-20180319.phpΔ

Comments

Can you provide a link to an example wiki page where this it installed. So we can have a look at it? Thanks! -- TeganDowling June 20, 2006, at 08:41 AM

I don't have a site with the recipe installed. Sorry! CarlosAB July 04, 2006, at 11:22 PM

The zip file has a directory structure in it. Please correct the archive to fit the pmWiki standard. (Not a huge issue - but still...) gdb

Thank you. The problem was solved.

It slowed down my site with 5-10 secs loading. Has anyone else experienced slowdowns? Is there room to self-optimize? //anony

  • Sure there is. CarlosAB January 08, 2011, at 03:04 PM

I have a question: Why does the searchcloud only collect search terms from the content-frame search box. Terms from the search box (in my case on the right, on top of the navigation)are not shown.Is it possible to change this? Kind regards Susanne

Yes, it is possible and it was supposed to work like that from the beginning, but I am thinking about redoing this recipe as it was not well done. Just wait for a while as new script will be made.


comment by Holger March 08, 2020, at 01:15 AM
After more than 9 years another comment: ;-) I am cuurently using PHP 7.3 and a error message comes up with "Function create_function() is deprecated" but I did not find "create_function" in your source code. It leads to an error since V7.2. Please have a look:Testwiki (will be deleted in a few days) . Is there a quick fix for that?

I like this cookbook recipe, maybe somebody can support. :-|

There is indeed an easy fix for this specific message: from the markup definition line, remove 4 characters:
Markup_e("searchcloud", "directives", '/\\(:searchcloud:\\)/i', "SearchCloudList()"); replace with
Markup("searchcloud", "directives", '/\\(:searchcloud:\\)/i', "SearchCloudList"); This will require at least PmWiki 2.2.58. --Petko March 08, 2020, at 05:20 AM

Petko, :-) You made my day. :-) Thanks a lot! I've now updated the recipe with this change. It works. :-) Holger

comment by Holger March 08, 2020, at 10:36 AM
Unfortunately there is another bug: Warning: Invalid argument supplied for foreach()

You can see the error message if you click on the top right hand corner of the page Testwiki without a searchterm, just click. Sorry... :-|

This can be fixed in a number of ways, one is adding if($x) at the start of line 81 like if($x) foreach($SCin as $k => $v){ -- I'll leave to the author/maintainer to select this solution or another one. --Petko March 08, 2020, at 09:46 AM

BTW you can use 4 tildes ~~~~ to insert your name and the date (UTC on the server, so it doesn't look as I replied before you asked ;-). --Petko March 08, 2020, at 09:48 AM

Again, thanks a lot for your great support also for the 4-Tildes hint! :-) Now it really works! Holger March 08, 2020, at 09:57 AM


comment by Holger January 06, 2011, at 06:46 AM
nfortunately backlinks are in the file used for storage. Is there a possibility to prevent this behavior in the next update? It looks not really good if there is a link in the list of the search terms. ;-)

Example (lines 79-81)

if ($action == "search" && $q != "" && stristr ($q,"link=")==false){
	SearchCloudIn($SCrq);
}

I'm gonna test it out to see why it doesn't look good. CarlosAB January 08, 2011, at 03:04 PM

See Also

Contributors

CarlosAB March 27, 2006, at 03:50 PM

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.