本文整理汇总了PHP中filter_results函数的典型用法代码示例。如果您正苦于以下问题:PHP filter_results函数的具体用法?PHP filter_results怎么用?PHP filter_results使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_results函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: main
function main()
{
if (strcmp('4.1.0', phpversion()) > 0) {
die("Error: PHP version 4.1.0 or above required!");
}
if (!($file = fopen("search.idx", "rb"))) {
die("Error: Search index file could NOT be opened!");
}
if (readHeader($file) != "DOXS") {
die("Error: Header of index file is invalid!");
}
$query = "";
if (array_key_exists("query", $_GET)) {
$query = $_GET["query"];
}
echo "<input class=\"search\" type=\"text\" name=\"query\" value=\"{$query}\" size=\"20\" accesskey=\"s\"/>\n";
echo "</span>\n";
echo "</form>\n";
echo "</div>\n";
$results = array();
$requiredWords = array();
$forbiddenWords = array();
$foundWords = array();
$word = strtok($query, " ");
while ($word) {
if ($word[0] == '+') {
$word = substr($word, 1);
$requiredWords[] = $word;
}
if ($word[0] == '-') {
$word = substr($word, 1);
$forbiddenWords[] = $word;
}
if (!in_array($word, $foundWords)) {
$foundWords[] = $word;
search($file, $word, $results);
}
$word = strtok(" ");
}
$docs = array();
combine_results($results, $docs);
// filter out documents with forbidden word or that do not contain
// required words
$filteredDocs = filter_results($docs, $requiredWords, $forbiddenWords);
// sort the results based on rank
$sorted = array();
sort_results($filteredDocs, $sorted);
// report results to the user
report_results($sorted);
fclose($file);
}
开发者ID:ninghang,项目名称:bayesianPlay,代码行数:51,代码来源:search.php
示例2: search
function search()
{
if (strcmp('4.1.0', phpversion()) > 0) {
die("Error: PHP version 4.1.0 or above required!");
}
$paths = paths();
$files = array();
$j = 0;
for ($i = 0; $i < sizeof($paths); $i++) {
if (!($f = @fopen($paths[$i] . "search.idx", "rb"))) {
die("Error: Search index file could NOT be opened!");
continue;
}
$files[$j++] = $f;
if (readHeader($f) != "DOXS") {
die("Error: Header of index file is invalid!");
}
}
$query = "";
if (array_key_exists("query", $_GET)) {
$query = $_GET["query"];
}
//end_form($query);
echo " \n<div class=\"searchresults\">\n";
$results = array();
$requiredWords = array();
$forbiddenWords = array();
$foundWords = array();
$word = strtok($query, " ");
while ($word) {
if ($word[0] == '+') {
$word = substr($word, 1);
$requiredWords[] = $word;
}
if ($word[0] == '-') {
$word = substr($word, 1);
$forbiddenWords[] = $word;
}
if (!in_array($word, $foundWords)) {
$foundWords[] = $word;
for ($i = 0; $i < sizeof($files); $i++) {
do_search($paths[$i], $files[$i], strtolower($word), $results);
}
}
$word = strtok(" ");
}
$docs = array();
combine_results($results, $docs);
// filter out documents with forbidden word or that do not contain
// required words
$filteredDocs = filter_results($docs, $requiredWords, $forbiddenWords);
// sort the results based on rank
$sorted = array();
sort_results($filteredDocs, $sorted);
// report results to the user
report_results($sorted);
echo "</div>\n";
foreach ($files as $file) {
fclose($file);
}
}
开发者ID:BackupTheBerlios,项目名称:senf-svn,代码行数:61,代码来源:search_functions.php
示例3: main
function main()
{
if (strcmp('4.1.0', phpversion()) > 0) {
die("Error: PHP version 4.1.0 or above required!");
}
if (!($file = fopen("search.idx", "rb"))) {
die("Error: Search index file could NOT be opened!");
}
if (readHeader($file) != "DOXS") {
die("Error: Header of index file is invalid!");
}
$query = "";
if (array_key_exists("query", $_GET)) {
$query = $_GET["query"];
}
end_form(ereg_replace("[^[:alnum:]:\\.\\t ]", " ", $query));
echo " \n<div class=\"searchresults\">\n";
$results = array();
$requiredWords = array();
$forbiddenWords = array();
$foundWords = array();
$word = strtok($query, " ");
while ($word) {
if ($word[0] == '+') {
$word = substr($word, 1);
$requiredWords[] = $word;
}
if ($word[0] == '-') {
$word = substr($word, 1);
$forbiddenWords[] = $word;
}
if (!in_array($word, $foundWords)) {
$foundWords[] = $word;
search($file, strtolower($word), $results);
}
$word = strtok(" ");
}
$docs = array();
combine_results($results, $docs);
// filter out documents with forbidden word or that do not contain
// required words
$filteredDocs = filter_results($docs, $requiredWords, $forbiddenWords);
// sort the results based on rank
$sorted = array();
sort_results($filteredDocs, $sorted);
// report results to the user
report_results($sorted);
echo "</div>\n";
fclose($file);
}
开发者ID:kobkob,项目名称:ta,代码行数:50,代码来源:search.php
示例4: main
function main($idxfile)
{
if (strcmp('4.1.0', phpversion()) > 0) {
die("Error: PHP version 4.1.0 or above required!");
}
if (!($file = fopen($idxfile, "rb"))) {
die("Error: Search index file could NOT be opened!");
}
if (readHeader($file) != "DOXS") {
die("Error: Header of index file is invalid!");
}
$query = "";
if (array_key_exists("query", $_GET)) {
$query = $_GET["query"];
}
$results = array();
$requiredWords = array();
$forbiddenWords = array();
$foundWords = array();
$word = strtolower(strtok($query, " "));
while ($word) {
if ($word[0] == '+') {
$word = substr($word, 1);
$requiredWords[] = $word;
}
if ($word[0] == '-') {
$word = substr($word, 1);
$forbiddenWords[] = $word;
}
if (!in_array($word, $foundWords)) {
$foundWords[] = $word;
search($file, $word, $results);
}
$word = strtolower(strtok(" "));
}
$docs = array();
combine_results($results, $docs);
// filter out documents with forbidden word or that do not contain
// required words
$filteredDocs = filter_results($docs, $requiredWords, $forbiddenWords);
// normalize rankings so they are in the range [0-100]
normalize_ranking($filteredDocs);
// sort the results based on rank
$sorted = array();
sort_results($filteredDocs, $sorted);
// report results to the user
report_results($sorted);
fclose($file);
}
开发者ID:jimeiyang,项目名称:deepRotator,代码行数:49,代码来源:doxysearch.php
注:本文中的filter_results函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论