aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-10-09 14:24:17 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-10-09 14:24:17 +0000
commitf007012cd9c85dcc9d1a5aa234f02a02989c2081 (patch)
treee3d06de18dd26d04b19061c711ff487d96aeb928 /doc
parent01992e044630e9bd74aff638e181c52fb294c266 (diff)
downloadandroid_external_libxml2-f007012cd9c85dcc9d1a5aa234f02a02989c2081.tar.gz
android_external_libxml2-f007012cd9c85dcc9d1a5aa234f02a02989c2081.tar.bz2
android_external_libxml2-f007012cd9c85dcc9d1a5aa234f02a02989c2081.zip
integrated the XSLT indexing, a few fixed in the indexer, added a scope
* doc/index.py doc/search.php: integrated the XSLT indexing, a few fixed in the indexer, added a scope selection at the search level. Daniel
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/index.py20
-rw-r--r--doc/search.php252
2 files changed, 216 insertions, 56 deletions
diff --git a/doc/index.py b/doc/index.py
index 600871b3..49a2cfc8 100755
--- a/doc/index.py
+++ b/doc/index.py
@@ -469,7 +469,6 @@ def cleanupWordsString(str):
str = string.replace(str, "'", " ")
str = string.replace(str, '"', " ")
str = string.replace(str, ";", " ")
- str = string.replace(str, "-", " ")
str = string.replace(str, "(", " ")
str = string.replace(str, ")", " ")
str = string.replace(str, "{", " ")
@@ -489,6 +488,7 @@ def cleanupWordsString(str):
return str
def cleanupDescrString(str):
+ str = string.replace(str, "'", " ")
str = string.replace(str, "\n", " ")
str = string.replace(str, "\r", " ")
str = string.replace(str, "\xc2", " ")
@@ -781,6 +781,8 @@ def analyzeAPIStruct(top):
info = top.prop("info")
if info != None:
+ info = string.replace(info, "'", " ")
+ info = string.strip(info)
l = string.split(info)
for word in l:
if len(word) > 2:
@@ -794,6 +796,8 @@ def analyzeAPIMacro(top):
symbol = top.prop("name")
if symbol == None:
return 0
+ symbol = string.replace(symbol, "'", " ")
+ symbol = string.strip(symbol)
info = None
cur = top.children
@@ -815,6 +819,8 @@ def analyzeAPIMacro(top):
print "Macro %s description has no <info>" % (symbol)
return 0
+ info = string.replace(info, "'", " ")
+ info = string.strip(info)
addMacro(symbol, file, info)
l = string.split(info)
for word in l:
@@ -830,6 +836,8 @@ def analyzeAPIFunction(top):
if symbol == None:
return 0
+ symbol = string.replace(symbol, "'", " ")
+ symbol = string.strip(symbol)
info = None
cur = top.children
while cur != None:
@@ -841,19 +849,27 @@ def analyzeAPIFunction(top):
elif cur.name == "return":
rinfo = cur.prop("info")
if rinfo != None:
+ rinfo = string.replace(rinfo, "'", " ")
+ rinfo = string.strip(rinfo)
addString(rinfo, file, symbol, 7)
elif cur.name == "arg":
ainfo = cur.prop("info")
- if rinfo != None:
+ if ainfo != None:
+ ainfo = string.replace(ainfo, "'", " ")
+ ainfo = string.strip(ainfo)
addString(ainfo, file, symbol, 5)
name = cur.prop("name")
if name != None:
+ name = string.replace(name, "'", " ")
+ name = string.strip(name)
addWord(name, file, symbol, 7)
cur = cur.next
if info == None:
print "Function %s description has no <info>" % (symbol)
addFunction(symbol, file, "")
else:
+ info = string.replace(info, "'", " ")
+ info = string.strip(info)
addFunction(symbol, file, info)
addString(info, file, symbol, 5)
diff --git a/doc/search.php b/doc/search.php
index 1d19db7d..232cd5f7 100644
--- a/doc/search.php
+++ b/doc/search.php
@@ -94,12 +94,32 @@ A:link, A:visited, A:active { text-decoration: underline }
if (! $query) {
echo "<h1 align='center'>Search the X documentation on XMLSoft.org</h1>";
}
+ if ($scope == NULL)
+ $scope = "any";
+ $scope = ltrim ($scope);
+ if ($scope == "")
+ $scope = "any";
+
?>
-<p> The search service indexes the XML API, the XML documentation and the xml@gnome.org mailing-list archive. To use it simply provide a set of keywords:
+<p> The search service indexes the libxml2 and libxslt APIs and documentation as well as the xml@gnome.org and xslt@gnome.org mailing-list archives. To use it simply provide a set of keywords:
<p>
<form action="<?php echo "$PHP_SELF", "?query=", rawurlencode($query) ?>"
enctype="application/x-www-form-urlencoded" method="GET">
<input name="query" type="TEXT" size="50" value="<?php echo $query?>">
+ <select name="scope">
+ <option value="any">Search All</option>
+ <option value="XML" <?php if ($scope == 'XML') print "selected"?>>XML resources</option>
+ <option value="XSLT" <?php if ($scope == 'XSLT') print "selected"?>>XSLT resources</option>
+ <option value="API" <?php if ($scope == 'API') print "selected"?>>Only the APIs</option>
+ <option value="XMLAPI" <?php if ($scope == 'XMLAPI') print "selected"?>>Only the XML API</option>
+ <option value="XSLTAPI" <?php if ($scope == 'XSLTAPI') print "selected"?>>Only the XSLT API</option>
+ <option value="DOCS" <?php if ($scope == 'DOCS') print "selected"?>>Only the Documentation</option>
+ <option value="XMLDOC" <?php if ($scope == 'XMLDOC') print "selected"?>>Only the XML Documentation</option>
+ <option value="XSLTDOC" <?php if ($scope == 'XSLTDOC') print "selected"?>>Only the XSLT Documentation</option>
+ <option value="LISTS" <?php if ($scope == 'LISTS') print "selected"?>>Only the lists archives</option>
+ <option value="XMLLIST" <?php if ($scope == 'XMLLIST') print "selected"?>>Only the XML list archive</option>
+ <option value="XSLTLIST" <?php if ($scope == 'XSLTLIST') print "selected"?>>Only the XSLT list archive</option>
+ </select>
<input name=submit type=submit value="Search ...">
</form>
<?php
@@ -152,7 +172,49 @@ A:link, A:visited, A:active { text-decoration: underline }
$result = NULL;
$j = 0;
if ($word) {
- $result = mysql_query ("SELECT wordsArchive.relevance, wordsArchive.name, 'mailing-list', archives.resource, archives.title FROM wordsArchive, archives WHERE LCASE(name) LIKE LCASE('$word') and wordsArchive.ID = archives.ID ORDER BY relevance DESC LIMIT 75");
+ $result = mysql_query ("SELECT wordsArchive.relevance, wordsArchive.name, 'xml-list', archives.resource, archives.title FROM wordsArchive, archives WHERE LCASE(wordsArchive.name) LIKE LCASE('$word') and wordsArchive.ID = archives.ID ORDER BY relevance DESC LIMIT 75");
+ if ($result) {
+ $j = mysql_num_rows($result);
+ if ($j == 0)
+ mysql_free_result($result);
+ }
+ logQueryWord($word);
+ }
+ return array($result, $j);
+ }
+ function XSLTqueryWord($word) {
+ $result = NULL;
+ $j = 0;
+ if ($word) {
+ $result = mysql_query ("SELECT XSLTwords.relevance, XSLTsymbols.name, XSLTsymbols.type, XSLTsymbols.module, XSLTsymbols.descr FROM XSLTwords, XSLTsymbols WHERE LCASE(XSLTwords.name) LIKE LCASE('$word') and XSLTwords.symbol = XSLTsymbols.name ORDER BY XSLTwords.relevance DESC LIMIT 75");
+ if ($result) {
+ $j = mysql_num_rows($result);
+ if ($j == 0)
+ mysql_free_result($result);
+ }
+ logQueryWord($word);
+ }
+ return array($result, $j);
+ }
+ function XSLTqueryHTMLWord($word) {
+ $result = NULL;
+ $j = 0;
+ if ($word) {
+ $result = mysql_query ("SELECT relevance, name, id, resource, section FROM XSLTwordsHTML WHERE LCASE(name) LIKE LCASE('$word') ORDER BY relevance DESC LIMIT 75");
+ if ($result) {
+ $j = mysql_num_rows($result);
+ if ($j == 0)
+ mysql_free_result($result);
+ }
+ logQueryWord($word);
+ }
+ return array($result, $j);
+ }
+ function XSLTqueryArchiveWord($word) {
+ $result = NULL;
+ $j = 0;
+ if ($word) {
+ $result = mysql_query ("SELECT XSLTwordsArchive.relevance, XSLTwordsArchive.name, 'xslt-list', archives.resource, archives.title FROM XSLTwordsArchive, archives WHERE LCASE(XSLTwordsArchive.name) LIKE LCASE('$word') and XSLTwordsArchive.ID = archives.ID ORDER BY relevance DESC LIMIT 75");
if ($result) {
$j = mysql_num_rows($result);
if ($j == 0)
@@ -180,67 +242,149 @@ A:link, A:visited, A:active { text-decoration: underline }
for ($number = 0;$number < count($list);$number++) {
$word = $list[$number];
- list($result, $j) = queryWord($word);
- if ($j > 0) {
- for ($i = 0; $i < $j; $i++) {
- $relevance = mysql_result($result, $i, 0);
- $name = mysql_result($result, $i, 1);
- $type = mysql_result($result, $i, 2);
- $module = mysql_result($result, $i, 3);
- $desc = mysql_result($result, $i, 4);
- if (array_key_exists($name, $results)) {
- list($r,$t,$m,$d,$w,$u) = $results[$name];
- $results[$name] = array(($r + $relevance) * 2,
- $t,$m,$d,$w,$u);
- } else {
- $id = strtoupper($name);
- $m = strtolower($module);
- $url = "html/libxml-$m.html#$id";
- $results[$name] = array($relevance,$type,
- $module, $desc, $name, $url);
+ if (($scope == 'any') || ($scope == 'XML') ||
+ ($scope == 'API') || ($scope == 'XMLAPI')) {
+ list($result, $j) = queryWord($word);
+ if ($j > 0) {
+ for ($i = 0; $i < $j; $i++) {
+ $relevance = mysql_result($result, $i, 0);
+ $name = mysql_result($result, $i, 1);
+ $type = mysql_result($result, $i, 2);
+ $module = mysql_result($result, $i, 3);
+ $desc = mysql_result($result, $i, 4);
+ if (array_key_exists($name, $results)) {
+ list($r,$t,$m,$d,$w,$u) = $results[$name];
+ $results[$name] = array(($r + $relevance) * 2,
+ $t,$m,$d,$w,$u);
+ } else {
+ $id = strtoupper($name);
+ $m = strtolower($module);
+ $url = "html/libxml-$m.html#$id";
+ $results[$name] = array($relevance,$type,
+ $module, $desc, $name, $url);
+ }
}
+ mysql_free_result($result);
}
- mysql_free_result($result);
}
- list($result, $k) = queryHTMLWord($word);
- if ($k > 0) {
- for ($i = 0; $i < $k; $i++) {
- $relevance = mysql_result($result, $i, 0);
- $name = mysql_result($result, $i, 1);
- $id = mysql_result($result, $i, 2);
- $module = mysql_result($result, $i, 3);
- $desc = mysql_result($result, $i, 4);
- $url = $module;
- if ($id != "") {
- $url = $url + "#$id";
+ if (($scope == 'any') || ($scope == 'XSLT') ||
+ ($scope == 'API') || ($scope == 'XSLTAPI')) {
+ list($result, $j) = XSLTqueryWord($word);
+ if ($j > 0) {
+ for ($i = 0; $i < $j; $i++) {
+ $relevance = mysql_result($result, $i, 0);
+ $name = mysql_result($result, $i, 1);
+ $type = mysql_result($result, $i, 2);
+ $module = mysql_result($result, $i, 3);
+ $desc = mysql_result($result, $i, 4);
+ if (array_key_exists($name, $results)) {
+ list($r,$t,$m,$d,$w,$u) = $results[$name];
+ $results[$name] = array(($r + $relevance) * 2,
+ $t,$m,$d,$w,$u);
+ } else {
+ $id = strtoupper($name);
+ $m = strtolower($module);
+ $url = "XSLT/html/libxslt-$m.html#$id";
+ $results[$name] = array($relevance,$type,
+ $module, $desc, $name, $url);
+ }
}
- $results[$name + "_html_" + $number+ "_" + $i] =
- array($relevance, "documentation",
+ mysql_free_result($result);
+ }
+ }
+ if (($scope == 'any') || ($scope == 'XML') ||
+ ($scope == 'DOCS') || ($scope == 'XMLDOC')) {
+ list($result, $k) = queryHTMLWord($word);
+ if ($k > 0) {
+ for ($i = 0; $i < $k; $i++) {
+ $relevance = mysql_result($result, $i, 0);
+ $name = mysql_result($result, $i, 1);
+ $id = mysql_result($result, $i, 2);
+ $module = mysql_result($result, $i, 3);
+ $desc = mysql_result($result, $i, 4);
+ $url = $module;
+ if ($id != "") {
+ $url = $url + "#$id";
+ }
+ $results["$name _html_ $number _ $i"] =
+ array($relevance, "XML docs",
$module, $desc, $name, $url);
+ }
+ mysql_free_result($result);
}
- mysql_free_result($result);
}
- list($result, $j) = queryArchiveWord($word);
- if ($j > 0) {
- for ($i = 0; $i < $j; $i++) {
- $relevance = mysql_result($result, $i, 0);
- $name = mysql_result($result, $i, 1);
- $type = mysql_result($result, $i, 2);
- $url = mysql_result($result, $i, 3);
- $desc = mysql_result($result, $i, 4);
- if (array_key_exists($url, $results)) {
- list($r,$t,$m,$d,$w,$u) = $results[$url];
- $results[$name] = array(($r + $relevance) * 2,
- $t,$m,$d,$w,$u);
- } else {
- $id = strtoupper($name);
- $m = strtolower($module);
- $u = str_replace("http://mail.gnome.org/archives/xml/", "", $url);
- $results[$url] = array($relevance,$type,
- $u, $desc, $name, $url);
+ if (($scope == 'any') || ($scope == 'XSLT') ||
+ ($scope == 'DOCS') || ($scope == 'XSLTDOC')) {
+ list($result, $k) = XSLTqueryHTMLWord($word);
+ if ($k > 0) {
+ for ($i = 0; $i < $k; $i++) {
+ $relevance = mysql_result($result, $i, 0);
+ $name = mysql_result($result, $i, 1);
+ $id = mysql_result($result, $i, 2);
+ $module = mysql_result($result, $i, 3);
+ $desc = mysql_result($result, $i, 4);
+ $url = "XSLT/$module";
+ if ($id != "") {
+ $url = $url + "#$id";
+ }
+ $results["$name xslthtml $number _ $i "] =
+ array($relevance, "XSLT docs",
+ $module, $desc, $name, $url);
}
+ mysql_free_result($result);
+ }
+ }
+ if (($scope == 'any') || ($scope == 'XML') ||
+ ($scope == 'LISTS') || ($scope == 'XMLLIST')) {
+ list($result, $j) = queryArchiveWord($word);
+ if ($j > 0) {
+ for ($i = 0; $i < $j; $i++) {
+ $relevance = mysql_result($result, $i, 0);
+ $name = mysql_result($result, $i, 1);
+ $type = mysql_result($result, $i, 2);
+ $url = mysql_result($result, $i, 3);
+ $desc = mysql_result($result, $i, 4);
+ if (array_key_exists($url, $results)) {
+ list($r,$t,$m,$d,$w,$u) = $results[$url];
+ $results[$name] = array(($r + $relevance) * 2,
+ $t,$m,$d,$w,$u);
+ } else {
+ $id = strtoupper($name);
+ $m = strtolower($module);
+ $u = str_replace(
+ "http://mail.gnome.org/archives/xml/", "", $url);
+ $results[$url] = array($relevance,$type,
+ $u, $desc, $name, $url);
+ }
+ }
+ mysql_free_result($result);
+ }
+ }
+ if (($scope == 'any') || ($scope == 'XSLT') ||
+ ($scope == 'LISTS') || ($scope == 'XSLTLIST')) {
+ list($result, $j) = XSLTqueryArchiveWord($word);
+ if ($j > 0) {
+ for ($i = 0; $i < $j; $i++) {
+ $relevance = mysql_result($result, $i, 0);
+ $name = mysql_result($result, $i, 1);
+ $type = mysql_result($result, $i, 2);
+ $url = mysql_result($result, $i, 3);
+ $desc = mysql_result($result, $i, 4);
+ if (array_key_exists($url, $results)) {
+ list($r,$t,$m,$d,$w,$u) = $results[$url];
+ $results[$name] = array(($r + $relevance) * 2,
+ $t,$m,$d,$w,$u);
+ } else {
+ $id = strtoupper($name);
+ $m = strtolower($module);
+ $u = str_replace(
+ "http://mail.gnome.org/archives/xslt/", "", $url);
+ $results[$url] = array($relevance,$type,
+ $u, $desc, $name, $url);
+ }
+ }
+ mysql_free_result($result);
}
- mysql_free_result($result);
}
if (($j <= 0) && ($k <= 0)) {
echo "<p> No result found for $word\n";