{\$searchresultsfor} "{\$phrase}"
{if \$itemcount > 0}
{foreach from=\$results item=entry}
- {\$entry->title} - {\$entry->urltxt} ({\$entry->weight}%)
{*
You can also instantiate custom behaviour on a module by module basis by looking at
the \$entry->module and \$entry->modulerecord fields in \$entry
ie: {if \$entry->module == 'News'}{News action='detail' article_id=\$entry->modulerecord detailpage='News'}
*}
{/foreach}
{\$timetaken}: {\$timetook}
{else}
{\$noresultsfound}
{/if}
EOT;
return $text;
}
function DefaultStopWords()
{
return 'i, me, my, myself, we, our, ours, ourselves, you, your, yours,
yourself, yourselves, he, him, his, himself, she, her, hers,
herself, it, its, itself, they, them, their, theirs, themselves,
what, which, who, whom, this, that, these, those, am, is, are,
was, were, be, been, being, have, has, had, having, do, does,
did, doing, a, an, the, and, but, if, or, because, as, until,
while, of, at, by, for, with, about, against, between, into,
through, during, before, after, above, below, to, from, up, down,
in, out, on, off, over, under, again, further, then, once, here,
there, when, where, why, how, all, any, both, each, few, more,
most, other, some, such, no, nor, not, only, own, same, so,
than, too, very';
}
function RemoveStopWordsFromArray($words)
{
$stop_words = preg_split("/[\s,]+/", $this->GetPreference('stopwords', $this->DefaultStopWords()));
return array_diff($words, $stop_words);
}
function StemPhrase($phrase)
{
$this->load_tools();
return search_StemPhrase($this,$phrase);
}
function AddWords($module = 'Search', $id = -1, $attr = '', $content = '', $expires = NULL)
{
$this->load_tools();
return search_AddWords($this,$module,$id,$attr,$content,$expires);
}
function DeleteWords($module = 'Search', $id = -1, $attr = '')
{
$this->load_tools();
return search_DeleteWords($this,$module,$id,$attr);
}
function DeleteAllWords($module = 'Search', $id = -1, $attr = '')
{
$db =& $this->GetDb();
$db->Execute('DELETE FROM '.cms_db_prefix().'module_search_index');
$db->Execute('DELETE FROM '.cms_db_prefix().'module_search_items');
@$this->SendEvent('SearchAllItemsDeleted',array($module, $id, $attr));
}
function GetHelp($lang='en_US')
{
return $this->Lang('help');
}
function GetAuthor()
{
return 'Ted Kulp';
}
function GetAuthorEmail()
{
return 'ted@cmsmadesimple.org';
}
function GetChangeLog()
{
return @file_get_contents(dirname(__FILE__).'/changelog.inc');
}
function RegisterEvents()
{
$this->AddEventHandler( 'Core', 'ContentEditPost', false );
$this->AddEventHandler( 'Core', 'ContentDeletePost', false );
$this->AddEventHandler( 'Core', 'AddTemplatePost', false );
$this->AddEventHandler( 'Core', 'EditTemplatePost', false );
$this->AddEventHandler( 'Core', 'DeleteTemplatePost', false );
$this->AddEventHandler( 'Core', 'AddGlobalContentPost', false );
$this->AddEventHandler( 'Core', 'EditGlobalContentPost', false );
$this->AddEventHandler( 'Core', 'DeleteGlobalContentPost', false );
$this->AddEventHandler( 'Core', 'ModuleUninstalled', false );
}
function Reindex()
{
$this->load_tools();
return search_Reindex($this);
}
function GetEventDescription( $eventname )
{
return $this->lang('eventdesc-' . $eventname);
}
function GetEventHelp( $eventname )
{
return $this->lang('eventhelp-' . $eventname);
}
function DoEvent($originator,$eventname,&$params)
{
$this->load_tools();
return search_DoEvent($this, $originator, $eventname, $params);
}
}
# vim:ts=4 sw=4 noet
?>