|
Cookbook /
SortByScoreSummary: Sorts
(:pagelist:) search results by number of matching words found in page + displays fragments of page near the word.Version: 2007-09-30 - v1.2
Prerequisites: PmWiki2
Files: sortbyscore.phpΔ
Status: beta
Maintainer: MateuszCzaplinski
Categories: Searching
Questions answered by this recipe
DescriptionSorts search results by score + shows page excerpts with search terms in bold. This recipe is intended to be used as a value for the
may result in results as shown below: PmWiki.ReleaseNotes - score 18 ...--XMLHeader-->@] and [@<!--XMLFooter-->@] as aliases for [@<!--...
...t or cookie. * The [[Site.SideBar]] page now defaults its edit ...
PmWiki.WikiGroup - score 15 ...e a default page in the group Foo, create a link to [=[[Foo/]]=...
....]]=]). To make a page called Bar in the group Foo, create a li...
PmWiki.ChangeLog - score 13 ...d <!--XMLHeader--> and <!--XMLFooter--> aliases to <!--HTMLHead...
...et [@{$Action}@] (reported by Bart). !!!Version 2.1.17 (2006-08...
By default, immediately after installation, this format will be set as the default format, in which your search results are displayed. InstallationInitial part of the installation is standard:
From now on the recipe is active. It is enabled by default for your search results page (Site.Search). If you want to disable that behaviour, you can add the following line to your
Notes
Release Notes
CommentsBy the way; I'm very interested in the reception of my recipes. Therefore, please feel encouraged to write a word or two where/how you use this recipe, if you fancy :). But only if you have time - no force intended here. Greetz, M.
Using v2.2.0 beta 17 and installation results in 0 search results being displayed. Disabling this and using the default search behavior provides correct results. Dec 26 06 - Ted Fixed in new version, now works with pmwiki-2.2.0-beta63 (although not necessarily with older betas!). Thanks! MateuszCzaplinski September 26, 2007, at 01:40 PM
2006-12-29 :: Chillax When search term includes a "/", I receive the following errors (the foreach error appears to occur once for each result found):
Warning: Invalid argument supplied for foreach() in /path/to/pmwiki/cookbook/sortbyscore.php on line 74
Warning: implode() [function.implode]: Bad arguments. in /path/to/pmwiki/cookbook/sortbyscore.php on line 85
I am using PmWiki v2.1.27 and have implemented PerGroupSubDirectories Fixed in new version. Thanks! MateuszCzaplinski September 26, 2007, at 01:40 PM
2007-01-03 Anke Wehner I'd like to have pages with the tearch term(s) in the page name displayed at the top of the list - maybe by giving those a default +100 on the score? But I don't understand the function well enough. Help? Implemented in new version. Thanks for the suggestion! MateuszCzaplinski September 26, 2007, at 01:40 PM
2007-02-12 Dan Raymond Can I get more than one line around the search term
I added this as an official option in Cookbook:Excerpts v1.2. Thanks for reporting! MateuszCzaplinski
2007-03-14 Steven Driskell After downloading sortbyscore.php, excerpts.php and updating the config.php file, I received the below error when executing a search: Fatal error: Call to undefined function: html_entity_decode() in excerpts.php on line 97. I think that must be because of PHP older than 4.3. A quick and possibly working solution should be changing line 97 in excerpts.php from html_entity_decode( trim( $par[1] ) ) ); to trim( $par[1] ) ); and also in line 101 fragment: $page to htmlspecialchars($page) That should work, hopefully not much slower. Thanks for info! MateuszCzaplinski April 01, 2007, at 04:56 PM
2007-04-02 Steven Driskell - The above code fixed my problem. Nice work! See AlsoContributorsUser notes +1: 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. |