summaryrefslogtreecommitdiff
path: root/buildscripts/index/build.php
diff options
context:
space:
mode:
authorxue <>2006-05-12 12:38:32 +0000
committerxue <>2006-05-12 12:38:32 +0000
commite2149e3d8b87b382563a9def6f376a5f289754d3 (patch)
treefd24e9c28d023a483cc632683e6e998d2e11bfce /buildscripts/index/build.php
parentd84327e69e858d369ea0c78f6106cfaa54994032 (diff)
Merge from 3.0 branch till 1054.
Diffstat (limited to 'buildscripts/index/build.php')
-rw-r--r--buildscripts/index/build.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/buildscripts/index/build.php b/buildscripts/index/build.php
new file mode 100644
index 00000000..9ec0d659
--- /dev/null
+++ b/buildscripts/index/build.php
@@ -0,0 +1,65 @@
+<?php
+/*
+ * Created on 10/05/2006
+ */
+
+/**
+ * Building search index for quickstart tutorials and the API documentation.
+ */
+
+
+//quickstart source and the index data target directories.
+$quickstart_source = realpath(dirname(__FILE__).'/../texbuilder/pages.php');
+$quickstart_base = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/pages/');
+$quickstart_target = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index/quickstart/');
+
+//API source and the index data target directories.
+$api_source = realpath(dirname(__FILE__).'/../../build/docs/manual/');
+$api_target = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index/api/');
+
+//get the ZEND framework
+$zend_path = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index');
+set_include_path(get_include_path().';'.$zend_path);
+require_once ('Zend/Search/Lucene.php');
+
+//get the indexers.
+include('quickstart_index.php');
+include('API_index.php');
+
+if(isset($argv[1]))
+{
+ if(strtolower($argv[1]) == "quickstart")
+ {
+ $quickstart = new quickstart_index($quickstart_target, $quickstart_base, $quickstart_source);
+ $quickstart->create_index();
+ }
+ else if(strtolower($argv[1]) == "api")
+ {
+ $api = new api_index($api_target, $api_source);
+ $api->create_index();
+ }
+ else
+ {
+ $q = new Zend_Search_Lucene($quickstart_target);
+ $query = $argv[1];
+ $hits = $q->find(strtolower($query));
+ echo "Found ".count($hits)." for ".$query." in quick start\n";
+ foreach($hits as $hit)
+ echo " ".$hit->title."\n";
+
+ $a = new Zend_Search_Lucene($api_target);
+ $query = $argv[1];
+ $hits = $a->find(strtolower($query));
+ echo "\nFound ".count($hits)." for ".$query." in API\n";
+ foreach($hits as $hit)
+ {
+ echo " ".$hit->link."\n";
+ }
+ }
+}
+else
+{
+ echo "Usage: 'php build.php quickstart' or 'php build.php api'\n";
+}
+
+?> \ No newline at end of file