OpenGuides::SuperSearch - Search form generation and processing for OpenGuides.
Does search stuff for OpenGuides. Distributed and installed as part of the OpenGuides project, not intended for independent installation. This documentation is probably only useful to OpenGuides developers.
use CGI; use Config::Tiny; use OpenGuides::SuperSearch; my $config = Config::Tiny->read( "wiki.conf" ); my $search = OpenGuides::SuperSearch->new( config => $config ); my %vars = CGI::Vars(); $search->run( vars => \%vars );
my $config = Config::Tiny->read( "wiki.conf" ); my $search = OpenGuides::SuperSearch->new( config => $config );
my %vars = CGI::Vars(); $search->run( vars => \%vars, return_output => 1, # defaults to 0 return_tt_vars => 1, # defaults to 0 );
return_outputparameter is optional. If supplied and true, the stuff that would normally be printed to STDOUT will be returned as a string instead.
return_tt_varsparameter is also optional. If supplied and true, the template is not processed and the variables that would have been passed to it are returned as a hash. This parameter takes precedence over
These two parameters exist to make testing easier; you probably don't want to use them in production.
a single word will be matched as-is. For example, a search on
will return all pages containing the word "escalator".
- AND searches
A list of words with no punctuation will be ANDed, for example:
will return all pages containing both the word "restaurant" and the word "vegetarian".
- OR searches
A list of words separated by commas (and optional spaces) will be ORed, for example:
will return all pages containing either the word "restaurant" or the word "cafe".
- NOT searches
Words and phrases preceded by a minus sign are excluded, for example:
will return all pages that contain the word "restaurant" and do not contain "expensive".
Note that a NOT search is used to qualify an existing search, so you cannot use -foo standalone to give you all pages without foo.
- phrase searches
Enclose phrases in double quotes, for example:
will return all pages that contain the exact phrase "meat pie" - not pages that only contain, for example, "apple pie and meat sausage".
Results will be put into some form of relevance ordering. These are the rules we have tests for so far (and hence the only rules that can be relied on):
A match on page title will score higher than a match on page category or locale.
A match on page category or locale will score higher than a match on page content.
Two matches in the title beats one match in the title and one in the content.
The OpenGuides Project (firstname.lastname@example.org)
Copyright (C) 2003-4 The OpenGuides Project. All Rights Reserved.
The OpenGuides distribution is free software; you can redistribute it and/or modify it under the same terms as Perl itself.