summaryrefslogtreecommitdiffstats
path: root/src/search_php.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/search_php.h')
-rw-r--r--src/search_php.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/search_php.h b/src/search_php.h
index ffd152a..86e97fa 100644
--- a/src/search_php.h
+++ b/src/search_php.h
@@ -21,15 +21,24 @@
"\n"
"function computeIndex($word)\n"
"{\n"
-" if (strlen($word)<2) return -1;\n"
+" $lword = strtolower($word);\n"
+" $l = strlen($lword);\n"
+" for ($i=0;$i<$l;$i++)\n"
+" {\n"
+" $c = ord($lword{$i});\n"
+" $v = (($v & 0xfc00) ^ ($v << 6) ^ $c) & 0xffff;\n"
+" }\n"
+" return $v;\n"
+"\n"
+" //if (strlen($word)<2) return -1;\n"
" // high char of the index\n"
-" $hi = ord($word{0});\n"
-" if ($hi==0) return -1;\n"
+" //$hi = ord($word{0});\n"
+" //if ($hi==0) return -1;\n"
" // low char of the index\n"
-" $lo = ord($word{1});\n"
-" if ($lo==0) return -1;\n"
+" //$lo = ord($word{1});\n"
+" //if ($lo==0) return -1;\n"
" // return index\n"
-" return $hi*256+$lo;\n"
+" //return $hi*256+$lo;\n"
"}\n"
"\n"
"function search($file,$word,&$statsList)\n"