
use FileArchiveIndexer::WUI::Base;

returns default template code

set variables to later inject See CGI::Application::Plugin::TmplInnerOuter
returns FileArchiveIndexer api object
optional argument is param name to look inside default param name is 'search_text' returns undef if none.
See "Building A Search Results Runmode"
sub fai_search_results : Runmode {
my $self = shift;
$self->_fai_search_results_text('search_text') or die('user did not enter search text'); # search_text is the default
# or
$self->_fai_search_results_text() or die('user did not enter search text');
$self->fai->execute($search_text);
$self->fai->results_count;
$self->fai->results_files;
foreach my $abs_found ( $self->fai->results_files ){
my $matches = $self->fai->result($abs_found);
# "You found $abs_found";
# "inside that file are the following matches to your search for $search_text;
for (@$matches){
my($page_number, $line_number, $content_matched ) = @$_;
# "page num : $page_number, line num : $line_number, content: $content_matched"
}
}
argument is abs path of the file found, returns array ref suitable as an HTML::Template loop.
my @RESULTS;
foreach my $abs_found ( $self->fai->results_files ){
my resultloop = $self->_get_result_hits_loop( $abs_found );
push @RESULTS, {
RESULT_ABS_FOUND => $abs_found,
RESULT_HITS => $resultloop,
};
}
$tmpl->param( RESULTS => \@RESULTS );
This would be suitable for:
<ul>
<TMPL_LOOP RESULTS>
<li>
<b><TMPL_VAR RESULT_ABS_FOUND></b>
<ul>
<TMPL_LOOP RESULT_HITS><li><small>page <TMPL_VAR PAGE_NUMBER>, line <TMPL_VAR LINE_NUMBER>, content </small><br><code><TMPL_VAR CONTENT></code></li></TMPL_LOOP>
</ul>
</li>
</TMPL_LOOP>
</ul>
sets vars :
FAI_SEARCH_RESULTS_COUNT FAI_SEARCH_RESULTS_TEXT