summaryrefslogtreecommitdiff
path: root/buildscripts/index
diff options
context:
space:
mode:
authorxue <>2006-06-19 02:31:27 +0000
committerxue <>2006-06-19 02:31:27 +0000
commitb59ab2490b1bb82dc1d0b58d89584182b405d0a0 (patch)
treed6770beffd006c092b3211208b686462cd279ab0 /buildscripts/index
parent9b918c5b7fa3aac6e077f15dc06c1d8d7185f5aa (diff)
build script update. Fixed #82 and #165.
Diffstat (limited to 'buildscripts/index')
-rw-r--r--buildscripts/index/api_index.php3
-rw-r--r--buildscripts/index/search.php36
2 files changed, 38 insertions, 1 deletions
diff --git a/buildscripts/index/api_index.php b/buildscripts/index/api_index.php
index ac2e37a7..c85fa267 100644
--- a/buildscripts/index/api_index.php
+++ b/buildscripts/index/api_index.php
@@ -25,6 +25,7 @@ class api_index
$count = 0;
foreach($files as $file)
{
+ echo " processing $file...\n";
$content = $this->get_details($file, $this->_api);
$doc = new Zend_Search_Lucene_Document();
@@ -86,8 +87,8 @@ class api_index
if(is_file($filepath) && $entry[0] !== '_')
$files[] = realpath($filepath);
}
- return $files;
$d->close();
+ return $files;
}
function get_doc_content($file)
diff --git a/buildscripts/index/search.php b/buildscripts/index/search.php
new file mode 100644
index 00000000..a34363f4
--- /dev/null
+++ b/buildscripts/index/search.php
@@ -0,0 +1,36 @@
+<?php
+
+if(isset($_GET['keyword']))
+ $keyword=trim($_GET['keyword']);
+else
+ $keyword='';
+
+$zend_path=realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index');
+set_include_path(get_include_path().PATH_SEPARATOR.$zend_path);
+require_once('Zend/Search/Lucene.php');
+
+if($keyword!=='')
+{
+ $search=new Zend_Search_Lucene(realpath(dirname(__FILE__)));
+ $results=$search->find(strtolower($keyword));
+ $content='';
+ foreach($results as $entry)
+ $content.="<li><a href=\"{$entry->link}\">{$entry->title}</a></li>\n";
+ if($content!=='')
+ {
+ $count=count($results);
+ $content="<p>Total <b>$count</b> pages matching keyword <b>".htmlentities($keyword)."</b>.\n<ol>\n$content</ol>\n";
+ }
+ else
+ $content="<p>No page matches <b>".htmlentities($keyword)."</b>.</p>";
+}
+else
+ $content="<p>Please specify a keyword to search for.</p>";
+
+$page=file_get_contents(dirname(__FILE__).'/index.html');
+$page=preg_replace('/<!-- content begin -->.*<!-- content end -->/ms',$content,$page);
+if($keyword!=='')
+ $page=preg_replace('/<input type="text" name="keyword"/','<input type="text" name="keyword" value="'.htmlentities($keyword).'"',$page);
+echo $page;
+
+?> \ No newline at end of file