Beispiel #1
0
                        echo "<td>" . $qa[3] . "</td>";
                    } else {
                        echo "<td>" . $qa[0] . "</td>";
                        echo "<td>Cancel</td>";
                        echo "<td>" . $qa[3] . "</td>";
                    }
                }
                echo "</tr>\n";
            }
            echo "</table>";
            echo "</td></tr></table>";
        }
    }
} else {
    if ($exec_query && $query && $selectedLAS['address']) {
        $success = logQuery($selectedLAS['address'], $query, $result, $query_id);
        echo "<br><br>";
        if ($success) {
            echo "<b>Query '{$query}' successfully executed ({$result})</b><br>\n";
            echo "Please wait while result is being computed and click 'Refresh result' to display query result.<br>\n";
            echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>\n";
            echo "<input type=submit name='refresh_result' value='Refresh result'>\n";
            echo "<input type=hidden name='las_address' value='" . $selectedLAS['address'] . "'>\n";
            echo "<input type=hidden name='query_id' value='{$query_id}'>\n";
            echo "<input type=hidden name='query' value='{$query}'>\n";
            echo "<input type='hidden' name='database' value='{$database}'>\n";
            for ($i = 0; $i < 10; ++$i) {
                echo "<input type='hidden' name='eid_{$i}' value='" . $GLOBALS["eid_{$i}"] . "'>\n";
            }
            echo "<input type='hidden' name='string' value='{$string}'>\n";
            echo "<input type='hidden' name='start_date' value='{$start_date}'>\n";
    $extendedQueryWordsArr = array_slice($extendedQueryWordsArr, 0, 25);
}
//preprint_r($extendedQueryWordsArr);
// SEARCH INVERTED INDEX FOR DOCUMENTS
$scoringTable = getScoredDocumentsFromInveretdIndex($extendedQueryWordsArr, $query, $isPhraseSearch, $isQuestion, $isColumnSearch, $columnSearchKeyValParams, $isConceptSearch, $lang, $isTransliterationSearch);
if ($isQuestion) {
    $answerInformationContainerArr = answerUserQuestion($query, $queryWordsArr, $taggedSignificantWords, $scoringTable, $lang);
    $userQuestionAnswerConceptsArr = $answerInformationContainerArr['ANSWER_CONCEPTS'];
    $userQuestionAnswerVersesArr = $answerInformationContainerArr['ANSWER_VERSES'];
    //preprint_r($userQuestionAnswerConceptsArr);
    $queryWordsArr = array_merge($queryWordsArr, $userQuestionAnswerConceptsArr);
}
/// LOG QUERY //LOCATION SIGNIFICANT BEFORE  handleEmptyResults because of exit inside
if (!isDevEnviroment()) {
    $searchType = getSearchType($isPhraseSearch, $isQuestion, $isColumnSearch, $isConceptSearch, $isTransliterationSearch);
    logQuery($lang, $query, $searchType, count($scoringTable));
}
// NOT RESULTS FOUND
handleEmptyResults($scoringTable, $extendedQueryWordsArr, $query, $originalQuery, $isColumnSearch, $searchType, $lang);
if (!$isQuestion && !$isColumnSearch) {
    // Check is some words were written incorrectly even if results are returned
    // اكثر الناس case should be أكثر
    $queryWordsWithoutDerivation = array_diff_assoc($extendedQueryWordsArr, $derivedWords);
    $postResultSuggestionArr = postResultSuggestions($lang, $originalQueryWordsArrSwaped);
    //echoN(memory_get_peak_usage());
    // remove query words from suggestion
    /*foreach($queryWordsWithoutDerivation as $word => $dummy)
    	{
    		if ( isset($postResultSuggestionArr[$word])) unset($postResultSuggestionArr[$word]);
    	}*/
    //preprint_r($postResultSuggestionArr);
Beispiel #3
0
 /**
  * Actually truncates a table. The rows can no longer be restored. Depending on your database
  * engine, the automatically incremented columns may be reset.
  * @return Database This instance to enable method chaining.
  */
 public function realTruncate()
 {
     $this->cleanup();
     $db = $this->prepareIdentifier($this->db);
     $table = $this->prepareIdentifier($this->table);
     // Sanity check
     if (empty($db) or empty($table)) {
         logMsg("Database: no database or table given", 3, 5);
         return $this;
     }
     $this->query = $query = "TRUNCATE TABLE `{$db}`.`{$table}`";
     logQuery($query);
     if (!$this->mysqli->query($query)) {
         $this->error = $this->mysqli->error;
     } else {
         $this->countAffectedRows = 1;
         logMsg("Database: successfully truncated table {$db}.{$table}", 3, 5);
     }
     return $this;
 }