|
|
@@ -44,18 +44,16 @@ if (isset($_GET["page"])) {
|
|
|
if (count($arrWordList) > 1) {
|
|
|
# 查询多个词
|
|
|
$out_data = array();
|
|
|
-
|
|
|
- /*
|
|
|
+ /*
|
|
|
PDO_Connect(_FILE_DB_PALITEXT_);
|
|
|
# 首先精确匹配
|
|
|
$words = implode(" ", $arrWordList);
|
|
|
$query = "SELECT book,paragraph, text as content FROM "._TABLE_PALI_TEXT_." WHERE text like ? LIMIT ? OFFSET ?";
|
|
|
$Fetch1 = PDO_FetchAll($query, array("%{$words}%", $_pagesize, $_page * $_pagesize));
|
|
|
- */
|
|
|
-
|
|
|
+
|
|
|
+*/
|
|
|
|
|
|
#postgresql full text search
|
|
|
-
|
|
|
$dns = _DB_ENGIN_.":host="._DB_HOST_.";port="._DB_PORT_.";dbname="._DB_NAME_.";user="._DB_USERNAME_.";password="._DB_PASSWORD_.";";
|
|
|
PDO_Connect($dns,_DB_USERNAME_,_DB_PASSWORD_);
|
|
|
|
|
|
@@ -102,31 +100,7 @@ if (count($arrWordList) > 1) {
|
|
|
$out_data[] = $newRecode;
|
|
|
}
|
|
|
$result["time"][] = array("event" => "fts精确匹配结束", "time" => microtime(true)-$_start);
|
|
|
- /*
|
|
|
- #然后查分散的
|
|
|
- $strQuery = "";
|
|
|
- foreach ($arrWordList as $oneword) {
|
|
|
- $strQuery .= "\"text\" like \"% {$oneword} %\" AND";
|
|
|
- }
|
|
|
- $strQuery = substr($strQuery, 0, -3);
|
|
|
-
|
|
|
- $query = "SELECT book,paragraph, html FROM pali_text WHERE {$strQuery} LIMIT 0,20";
|
|
|
- $Fetch2 = PDO_FetchAll($query);
|
|
|
|
|
|
- foreach ($Fetch2 as $key => $value) {
|
|
|
- # code...
|
|
|
- $newRecode["title"] = $_dbPaliText->getTitle($value["book"], $value["paragraph"]);
|
|
|
- $newRecode["path"] = _get_para_path($value["book"], $value["paragraph"]);
|
|
|
- $newRecode["book"] = $value["book"];
|
|
|
- $newRecode["para"] = $value["paragraph"];
|
|
|
- $newRecode["palitext"] = $value["text"];
|
|
|
- $newRecode["keyword"] = $arrWordList;
|
|
|
- $newRecode["wt"] = 0;
|
|
|
- $out_data[] = $newRecode;
|
|
|
- }
|
|
|
-
|
|
|
- $result["time"][] = array("event" => "查分散的结束", "time" => microtime(true)-$_start);
|
|
|
-*/
|
|
|
$result["data"] = $out_data;
|
|
|
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|
|
|
# 然后查特别不精确的
|