visuddhinanda 5 лет назад
Родитель
Сommit
8520968476

+ 1 - 1
app/dict/word_statistics.php

@@ -53,7 +53,7 @@ include "../pcdl/html_head.php";
     <div id="container"></div>
 </figure>
 <figure class="highcharts-figure">
-    <div id="container_list" style="height:50em;"></div>
+    <div id="container_list" style="height:56em;"></div>
 </figure>
 </div>
 

+ 0 - 0
app/search/_FILE_DB_RES_INDEX_


+ 1 - 1
app/search/paliword_search.php

@@ -163,7 +163,7 @@ switch($op){
 		echo "<div id=\"dict_bold_right\" style='flex:7;'>";
 		//前20条记录
 		$time_start=microtime_float();
-		$dictFileName=_FILE_DB_WORD_INDEX_;
+		$dictFileName=_FILE_DB_PALI_INDEX_;
 		PDO_Connect("sqlite:$dictFileName");
 		$query = "SELECT book,paragraph, wordindex FROM word WHERE \"wordindex\" in $strQueryWordId and book in $strFirstBookList group by book,paragraph LIMIT 0,20";
 		$Fetch = PDO_FetchAll($query);

+ 13 - 5
app/search/word_function.php

@@ -97,7 +97,7 @@ function render_book_list($strWordlist,$booklist=null){
 				
 }
 
-function countWordInPali($word,$sort=false){
+function countWordInPali($word,$sort=false,$limit = 0){
             //加语尾
             $case =  $GLOBALS['case'];
             $union = $GLOBALS['union'];
@@ -144,13 +144,21 @@ function countWordInPali($word,$sort=false){
         $user = "";
         $password = "";
         $PDO = new PDO($dsn, $user, $password,array(PDO::ATTR_PERSISTENT=>true));
-        $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+		$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+		if($limit==0){
+			$sSqlLimit = "";
+		}
+		else{
+			$sSqlLimit = "limit 0 , ".$limit;
+		}
         if($sort){
-            $query = "select id,word,count,bold,len from wordindex where \"word\" in  $strQueryWord order by count DESC";
+			$sSqlSort = "order by count DESC";
         }
         else{
-            $query = "select id,word,count,bold,len from wordindex where \"word\" in  $strQueryWord";
-        }
+			$sSqlSort = "";
+		}
+		
+		 $query = "select id,word,count,bold,len from wordindex where \"word\" in  $strQueryWord ".$sSqlSort . " ".$sSqlLimit;
         
         $stmt = $PDO->query($query);
         $arrRealWordList = $stmt->fetchAll(PDO::FETCH_ASSOC);

+ 10 - 8
app/search/word_list.php

@@ -8,6 +8,8 @@ require_once "../public/load_lang.php";//语言文件
 require_once "../public/function.php";
 require_once "../search/word_function.php";
 
+define("word_limit",12); //最大单词数量
+
     $resulte = array();
 
     if(isset($_GET["word"])){
@@ -25,7 +27,7 @@ require_once "../search/word_function.php";
 
 
 	//计算某词在三藏中出现的次数		
-    $arrRealWordList = countWordInPali($word);
+    $arrRealWordList = countWordInPali($word,true,word_limit);
 
     $countWord=count($arrRealWordList);
     if($countWord==0){
@@ -64,6 +66,7 @@ require_once "../search/word_function.php";
         $wordid=$aShowWordIdList[$x];
         $wordlist[] = $x;
         $wordlist_index[$x] = $i;
+
         $sutta[]=0;
         $vinaya[]=0;
         $abhidhamma[]=0;
@@ -76,14 +79,14 @@ require_once "../search/word_function.php";
     	//查找这些词出现在哪些书中
 	$arrBookType=json_decode(file_get_contents("../public/book_name/booktype.json"));
 	$dictFileName=_FILE_DB_BOOK_WORD_;
-	PDO_Connect("sqlite:$dictFileName");	
+	PDO_Connect("sqlite:$dictFileName");
 	if(isset($booklist)){
 		foreach($booklist as $oneBook){
 			$aInputBook["{$oneBook}"]=1;
 		}
 	}
 	$query = "select book, wordindex,count from bookword where \"wordindex\" in $strQueryWordId ";
-	$Fetch = PDO_FetchAll($query);
+    $Fetch = PDO_FetchAll($query);
 	$iFetch=count($Fetch);
     $newBookList=array();
 
@@ -92,8 +95,9 @@ require_once "../search/word_function.php";
 	if($iFetch>0){
 		for($i=0;$i<$iFetch;$i++){
 			$book=$Fetch[$i]["book"];
-
-			array_push($newBookList,array($book,$sum));
+             
+            array_push($newBookList,array($book,$sum));
+            
 			$t1=$arrBookType[$book-1]->c1;
             $t2=$arrBookType[$book-1]->c2;
             switch($t1){
@@ -117,13 +121,11 @@ require_once "../search/word_function.php";
 
         }
     }
-    $worddata[] = array( "name" => "anna","anna" => $anna);  
+    $worddata[] = array( "name" => "anna","data" => $anna);  
     $worddata[] = array( "name" => "abhidhamma","data" => $abhidhamma);      
     $worddata[] = array( "name" => "vinaya","data" => $vinaya);    
     $worddata[] = array( "name" => "sutta","data" => $sutta);
 
-
-
     $resulte["data"] = $worddata;
 
     echo json_encode($resulte,JSON_UNESCAPED_UNICODE);