diff --git a/create.php b/create.php index f0b1a80..7a88784 100755 --- a/create.php +++ b/create.php @@ -38,7 +38,7 @@ echo "

Goto echo "

Goto http://$id.$HTTP_HOST to grep!

"; } -symlink ("$id.txt", "tweets.txt"); +symlink ("$id.txt.gz", "tweets.txt.gz"); echo `sed -e "s,TIMESTAMP,$(date)," ../../greptweet.appcache > greptweet.appcache`; echo "
";
diff --git a/fetch-tweets.sh b/fetch-tweets.sh
index bd04824..b679918 100755
--- a/fetch-tweets.sh
+++ b/fetch-tweets.sh
@@ -26,6 +26,8 @@ fi
 page=1
 saved=0
 
+test -s "$1.txt.gz" && gunzip "$1.txt.gz"
+
 if test -s "$1.txt"
 then
 	saved=$(wc -l < "$1.txt")
@@ -61,3 +63,5 @@ saved=$(wc -l < "$1.txt")
 done
 
 echo $1 saved $saved tweets
+
+gzip "$1.txt"
diff --git a/grep.php b/grep.php
index ab5e324..28c9a72 100644
--- a/grep.php
+++ b/grep.php
@@ -10,7 +10,7 @@ $QUERY=urldecode(escapeshellarg(urlencode($_GET['q'])));
 //fwrite($fp, $_GET['q'] . " : " . $QUERY . "\n");
 //fclose($fp);
 
-exec("grep -hi $QUERY tweets.txt", $array);
+exec("zgrep -hi $QUERY tweets.txt", $array);
 $data = json_encode($array);
 echo $_GET['jsoncallback'] . '(' . $data . ');';
 ?>