summaryrefslogtreecommitdiff
path: root/buildscripts/index
diff options
context:
space:
mode:
authorxue <>2006-06-19 18:38:29 +0000
committerxue <>2006-06-19 18:38:29 +0000
commit588727c7e2b8954ec3dbde293cf4c4d68b119f9b (patch)
treefdcc16181a20335547953ccf1550e0006c11bf28 /buildscripts/index
parent127f78a4db3cc0fbbbb92f5b1abcfdce4a9af93b (diff)
Merge from 3.0 branch till 1185.
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