Apache::Wyrd::Site::SearchResults - Perform a word-search of Pages
<BASENAME::SearchResults max="20"> <BASENAME::Template name="list"><table>$:items</table></BASENAME::Template> <BASENAME::Template name="item"> <tr><td><a href="$:name">$:title</a>?:published{, posted: $:published} ?:description{<BR>—$:description}</td></tr> </BASENAME::Template> <BASENAME::Template name="instructions> ...instructions here... </BASENAME::Template> <BASENAME::Template name="failed> The search for <BASENAME::CGISetter> "$:searchstring" </BASENAME::CGISetter>did not produce any results. </BASENAME::Template> </BASENAME::SearchResults>
SearchResults is another form of Apache::Wyrd::Site::Pull, which uses the contents of the CGI variable "searchstring" to produce a list of search results from an Apache::Wyrd::Site::Index object. The searchstring variable can use any combination of parens, quotes, logical terms and +/- elements to limit the wordsearch to a smaller set. This Pull processes the list of hashrefs of document metadata returned by the index object.
Apache::Wyrd::Site::Pull
Apache::Wyrd::Site::Index
The SearchResults object also adds to each result item the key-value pairs:
Meaning the rank (1 = best) of the document as to relevance within the search set.
The ordinal number of the item in the found set.
Meaning the relative rank of the document in comparison with the others of the found set (in percent, 100=best).
The generic, unweighted relevance score, based on a function of word-incidents to document size (wordcount).
To allow the individual items of the "search results" block to be related to each other. Additionally, if a previous search result is given in the CGI variable "previous" and the CGI variable "within" is a non-null value (as would be returned by a hidden INPUT tag named "previous" and a checkbox named "within", The searcstring will be limited to the previous results.
Additionally, the CGI variable "max" is used to limit the search results to "max" number of items or less, and the "next" and "beginning" CGI variables are used to define a window of "max" number of of search results within a search set, which is to say that as the frame moves to the window defined by "next", the Apache::Wyrd::Intefaces::Setter elements will set $:next in the list template to the current value of the CGI variable "next" + the value of "max". This allows the webmaster to easily construct a moving-window search result.
Apache::Wyrd::Intefaces::Setter
$:next
How many digits after the decimal point to include in weighted results.
Which attributes of the sorted objects should be used to sort the list. Note that if a sort item begins with "rev_", the sort is performed in reverse.
What to provide in case no searchstring parameter was given.
What to provide in case of a failed search. Often suppled as an Apache::Wyrd::Template Wyrd.
As with Apache::Wyrd::Site::Pull, the templates (also often supplied as Apache::Wyrd::Template Wyrds, which provide formatting to the list itself and to the items of the list.
Sort in reverse.
Sort by weighted relevance rather than generic score.
(format: (returns) name (arguments after self))
_set_defaults
method description
_doc_filter
A "hook" method for filtering each (hashref-ed) search result. The search results are given as an array of hashrefs, and similar array is expected.
Reserves the _format_output method.
Barry King <wyrd@nospam.wyrdwright.com>
General-purpose HTML-embeddable perl object
Various index objects for site organization.
Convenience class for Wyrds which interface with Indexes
Abstract class for lists of pages
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd.
Apache::Wyrd
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install Apache::Wyrd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Wyrd
CPAN shell
perl -MCPAN -e shell install Apache::Wyrd
For more information on module installation, please visit the detailed CPAN module installation guide.