| CODENOTIFIER | HelpYou are not signed inSign in |
Project: ThruDB
Revision: 355
Author: jake
Date: 20 Apr 2008 22:08:05
Diff at Trac: http://trac.thrudb.org/changeset/355
Changes:Diff:| ... | ...@@ -3,7 +3,7 @@ | |
| 3 | 3 | use strict; |
| 4 | 4 | use warnings; |
| 5 | 5 | |
| 6 | use lib "../gen-perl"; | |
| 6 | use lib "../../gen-perl"; | |
| 7 | 7 | |
| 8 | 8 | use CGI qw/:standard/; |
| 9 | 9 | use HTML::Template; |
| ... | ...@@ -27,6 +27,7 @@ | |
| 27 | 27 | |
| 28 | 28 | package TweetScan; |
| 29 | 29 | use Time::HiRes qw(gettimeofday); |
| 30 | use HTML::Entities; | |
| 30 | 31 | use Data::Dumper; |
| 31 | 32 | |
| 32 | 33 | #Config |
| ... | ...@@ -60,6 +61,8 @@ | |
| 60 | 61 | |
| 61 | 62 | eval{ |
| 62 | 63 | my $socket = new Thrift::Socket("localhost",THRUDOC_PORT()); |
| 64 | $socket->setRecvTimeout(5000); | |
| 65 | ||
| 63 | 66 | my $transport = new Thrift::FramedTransport($socket); |
| 64 | 67 | my $protocol = new Thrift::BinaryProtocol($transport); |
| 65 | 68 | $self->{thrudoc} = new ThrudocClient($protocol); |
| ... | ...@@ -78,6 +81,8 @@ | |
| 78 | 81 | |
| 79 | 82 | eval{ |
| 80 | 83 | my $socket = new Thrift::Socket("localhost",THRUDEX_PORT()); |
| 84 | $socket->setRecvTimeout(5000); | |
| 85 | ||
| 81 | 86 | my $transport = new Thrift::FramedTransport($socket); |
| 82 | 87 | my $protocol = new Thrift::BinaryProtocol($transport); |
| 83 | 88 | $self->{thrudex} = new ThrudexClient($protocol); |
| ... | ...@@ -179,9 +184,17 @@ | |
| 179 | 184 | |
| 180 | 185 | if( defined $terms && $terms ne ""){ |
| 181 | 186 | |
| 187 | $terms = HTML::Entities::encode($terms); | |
| 188 | ||
| 189 | #escape this bad boy | |
| 190 | my $pterms = $terms; | |
| 191 | $pterms =~ s/([\+\-\&\|\!\(\)\{\}\[\]\^\"\~\*\?\:\\])/\\$1/g; | |
| 192 | $pterms = "+".join(" +",split(/\s+/,$pterms)); | |
| 193 | ||
| 194 | ||
| 182 | 195 | my $t0 = gettimeofday(); |
| 183 | 196 | |
| 184 | my ($total,$tweets) = $self->search( $terms, $offset ); | |
| 197 | my ($total,$tweets) = $self->search( $pterms, $offset ); | |
| 185 | 198 | |
| 186 | 199 | my $t1 = gettimeofday(); |
| 187 | 200 |