-
-};
+sub debug {
+ my ($text,$var) = @_;
+ print "
$text = ", dump($var), ""; +} -my $node = new Search::Estraier::Node(%{ $config->{estraier} }); +#debug('config', $config); -my $o = $q->param('index') || 0; -my $search = $q->param('q'); +sub json { + return + ''; +} -my $on_page = 30; -my $skip = $o * $on_page; +sub sort_order { + my $out; -my $cond = new Search::Estraier::Condition; -$cond->set_phrase( $search ); -$cond->set_max( $on_page ); -$cond->set_skip( $skip ); - -my $nres = $node->search($cond, ( $config->{estraier}->{depth} || 0 ) ); - -my $max = 0; - -if (defined($nres)) { - $max = $nres->hits; - print qq{ - - }; - - sub html_snippet { - my $text = shift || return; - my $out = ''; - foreach my $s (split(/[\n\r]{2}/, $text)) { - $out .= ' ... ' if ($out); - my ($pre,$hit,$post) = split(/\n/,$s,3); - $hit =~ s/\t.*$//; - $out .= - $q->escapeHTML( $pre || '' ) . '' . - $q->escapeHTML( $hit || '' ) . '' . - $q->escapeHTML( $post || ''); - } - return $out; + my $sort = $q->param('sort'); + + $out .= ''; +} - # for each document in results - for my $i ( 0 ... $nres->doc_num - 1 ) { +sub get_results { + my $p = {@_}; - my $rdoc = $nres->get_doc($i); + my ($search,$page) = ( $p->{search} , $p->{page}); - print "
' .
+ join("\n", @_) . json() . '
';
+ }
- print "", $rdoc->attr('@title'),"
\n"; - print "", $rdoc->attr('source'),"
\n"; - print "", html_snippet( $rdoc->snippet ),"\n"; - print "[", $skip + $i, "] "; - print "", $rdoc->attr('@uri'),""; - print "