/[jquery]/no_pager/index.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /no_pager/index.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4 by dpavlin, Tue Aug 15 16:03:16 2006 UTC revision 9 by dpavlin, Wed Aug 16 00:29:08 2006 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4    
5  use CGI::Simple;  use CGI::Simple;
6  use CGI::Carp qw(fatalsToBrowser);  use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
7  use Search::Estraier;  use Search::Estraier;
8    use YAML::Syck;
9    use Data::Dump qw/dump/;
10    
11  my $q = new CGI::Simple;  my $q = new CGI::Simple;
12  print qq{Content-type: text/html\n\r\n\r};  print qq{Content-type: text/html\n\r\n\r};
13    
14    my $config = LoadFile('config.yml');
15    
16    #warn "config = ", dump($config);
17    
18  if ($q->path_info() eq '/snippet') {  if ($q->path_info() eq '/snippet') {
19    
20  print qq{  print qq{
# Line 24  print qq{ Line 30  print qq{
30          <ul>          <ul>
31  };  };
32    
33  my $node = new Search::Estraier::Node(  my $node = new Search::Estraier::Node(%{ $config->{estraier} });
         url => 'http://localhost:1978/node/books',  
         user => 'admin',  
         passwd => 'admin',  
         croak_on_error => 1,  
 );  
34    
35  my $o = $q->param('index') || 0;  my $o = $q->param('index') || 0;
36  my $search = $q->param('q');  my $search = $q->param('q');
# Line 42  $cond->set_phrase( $search ); Line 43  $cond->set_phrase( $search );
43  $cond->set_max( $on_page );  $cond->set_max( $on_page );
44  $cond->set_skip( $skip );  $cond->set_skip( $skip );
45    
46  my $nres = $node->search($cond, 0);  my $nres = $node->search($cond, ( $config->{estraier}->{depth} || 0 ) );
47    
48  my $max = 0;  my $max = 0;
49    
50  if (defined($nres)) {  if (defined($nres)) {
51          $max = $nres->hits;          $max = $nres->hits;
52          print "Got ", $nres->hits, " results for $search\n";          print qq{
53                    <div id="status_update" style="display:none;">
54                            Got $max results for $search
55                    </div>
56            };
57    
58          sub html_snippet {          sub html_snippet {
59                  my $text = shift || return;                  my $text = shift || return;

Legend:
Removed from v.4  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.26