}
if (count($extendedQueryWordsArr) > 25) {
    $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]);
$pauseMarksFile = dirname(__FILE__) . "/data/pause.marks";
$arabicStopWordsFile = dirname(__FILE__) . "/data/quran-stop-words.strict.l1.ar";
$arabicStopWordsFileL2 = dirname(__FILE__) . "/data/quran-stop-words.strict.l2.ar";
$englishStopWordsFile = dirname(__FILE__) . "/data/english-stop-words.en";
$sajdahMark = "۩";
$saktaLatifaMark = "ۜ";
$numberOfVerses = 6236;
$numberOfSuras = 114;
$basmalaText = "بسم الله الرحمن الرحيم";
$basmalaTextUthmani = "بِّسْمِ ٱللَّهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ";
$basmalaTextUthmani2 = "بِسْمِ ٱللَّهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ";
$mandatoryStop = "ۘ";
## LOCATION SIGNIFICANT ##
require_once $MAIN_ROOT_PATH . "/libs/core.lib.php";
require_once $MAIN_ROOT_PATH . "/model.loader.php";
if (isDevEnviroment()) {
    error_reporting(E_ERROR);
    ini_set('display_errors', true);
    function shutdown()
    {
        $isSevereError = false;
        $errorArr = error_get_last();
        if (!empty($errorArr)) {
            switch ($errorArr['type']) {
                case E_ERROR:
                    //case E_USER_ERROR:
                //case E_USER_ERROR:
                case E_CORE_ERROR:
                case E_COMPILE_ERROR:
                    $isSevereError = true;
                    break;
Example #3
0
function addToMemoryModelBatch($entryKeysValuesArr)
{
    $resArr = apc_add($entryKeysValuesArr);
    if ($resArr === FALSE) {
        if (isDevEnviroment()) {
            echoN("APC Response");
            preprint_r($resArr);
        }
        throw new Exception("Can't add batch Cache Entries to Memory !");
    }
}