diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2002-10-09 14:24:17 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2002-10-09 14:24:17 +0000 |
commit | f007012cd9c85dcc9d1a5aa234f02a02989c2081 (patch) | |
tree | e3d06de18dd26d04b19061c711ff487d96aeb928 /doc/search.php | |
parent | 01992e044630e9bd74aff638e181c52fb294c266 (diff) | |
download | android_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/search.php')
-rw-r--r-- | doc/search.php | 252 |
1 files changed, 198 insertions, 54 deletions
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"; |