Just add google custom search onto my website. See webeyes for more details.
WordPress’ search box itself seems pretty powerless. Say I have lots of pdf files attached to my blog, wordpress can’t search the contents.
Find swish-e, which, after indexing wherever you appointed, is extremely fast to search whatever you want.
Unfortunately, it seems not working for chinese. For html file, grep -r “searching words” searchingdir is ok. For pdf, still a problem.
Googled a piece of php code for web-based grep search for txt or html file (not for pdf):
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2 Final//EN”>
<HTML>
<HEAD>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf8″>
<TITLE>Search</TITLE>
</HEAD>
<BODY><?php
// since we use POST method, get global value into ‘test’ string
$test=$_POST[‘sstr’];
// added to scrutinize input to inhibit malicious stuff
$j = mb_strlen($test);
for ($k = 0; $k < $j; $k++) {
$char = mb_substr($test, $k, 1);
if ($char == “;” || $char == “&” || $char == “>” || $char == “<” || $char == “|”) {
print “character: $char is not allowed, try again.<br>”; exit;}
}// check if submit button pressed and some search value entered
if (isset($_POST[‘submit’]) && ! empty($test) )
{
// set file and path to search
$file=”txt/” . $_POST[d_file];// check the file is readable
if (! is_readable ($file)) {
print “ERROR accessing file $file, please contact the admin.<br>”; exit;}// build the search command
$cmdstr=”grep -r $test $file”;
echo “<A href=\”$_SERVER[PHP_SELF]\”>Search more …</A>\t”;
echo “<p>Search results for $test in $file …</p>”;
flush();// search the file, display the result
$fp = popen($cmdstr . ‘ 2>&1’, ‘r’); // open proc pointer
echo “<pre>”;
while ($buffer = fgets($fp, 4096))
{
echo(“http://www.softbeam.net/$buffer”);
}
echo “</pre>”;
echo “<p>END</p>\n”;
pclose($fp);
flush();
exit;
}?>
<br>
<h2 align=”center”>全文查询</h2>
<p><h4 align=”center”>
<form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”POST”>
Select the category to search:<br>
<select name=”d_file”>
<option value=”literature/chinese”>——all chinese literature</option>
<option value=”literature/western”>——all western literature</option>
<option value=”literature”>——–all literature</option>
<option value=”history”>——–all history</option>
</select><br><br>
<input type=”text” name=”sstr” size=”30″ maxlength=”30″><br><br>
<input type=”submit” name=”submit” value=”Zzzzz”>
</form>
</h4></p></BODY>
</HTML>
Here is another approach:
Using Google Desktop Search as a network search server
For windows server, it works by combination with DNKA. For linux server,although google desktop has linux version available – GDL, DNKA seems not linux ready.