iliaa Mon May 24 17:06:15 2004 EDT
Modified files:
/livedocs search.php
Log:
Slight optimization.
http://cvs.php.net/diff.php/livedocs/search.php?r1=1.7&r2=1.8&ty=u
Index: livedocs/search.php
diff -u livedocs/search.php:1.7 livedocs/search.php:1.8
--- livedocs/search.php:1.7 Mon Feb 16 12:54:59 2004
+++ livedocs/search.php Mon May 24 17:06:14 2004
@@ -18,7 +18,7 @@
// | Search page |
// +----------------------------------------------------------------------+
//
-// $Id: search.php,v 1.7 2004/02/16 17:54:59 derick Exp $
+// $Id: search.php,v 1.8 2004/05/24 21:06:14 iliaa Exp $
define('LIVEDOC_SOURCE', dirname(__FILE__));
include './common.php';
@@ -43,8 +43,7 @@
sqlite_query($idx, "INSERT INTO cache_data (toc_id, qry_id, pos)
SELECT fs.toc_id, '{$id}', count(fs.toc_id) AS cnt FROM
full_search fs WHERE fs.skey IN(" .
implode(',', $qry) . ") GROUP BY fs.toc_id ORDER BY cnt DESC LIMIT 300");
- $ttl = sqlite_fetch_string(sqlite_query($idx, "SELECT count(*) FROM
cache_data WHERE qry_id={$id}"));
- if ($ttl) {
+ if (($ttl = sqlite_single_query($idx, "SELECT count(*) FROM cache_data
WHERE qry_id={$id}"))) {
sqlite_query($idx, "UPDATE search_cache SET ttl={$ttl} WHERE
id={$id}");
}
}
@@ -61,7 +60,7 @@
}
if ($strict) {
- if (!($ttl = sqlite_fetch_string(sqlite_query($idx, "SELECT count(*)
FROM cache_data WHERE qry_id={$id} AND pos=" . count($qry))))) {
+ if (!($ttl = sqlite_single_query($idx, "SELECT count(*) FROM
cache_data WHERE qry_id={$id} AND pos=" . count($qry)))) {
return 0;
}
return sqlite_array_query($idx, "SELECT t.docbook_id, t.title,
t.descr, cd.pos FROM cache_data cd INNER JOIN toc t ON cd.toc_id=t.id WHERE
cd.qry_id={$id} AND pos=" . count($qry) . " ORDER BY cd.pos DESC LIMIT {$start}," .
RESULT_PER_PAGE);