Esempio n. 1
0
    smarty_assign('results', $searchResults);
}
// Normal search
if ($searchType == SEARCH_INFLECTED) {
    $lexems = Lexem::searchInflectedForms($cuv, $hasDiacritics, true);
    if (count($lexems) == 0) {
        $cuv_old = StringUtil::tryOldOrthography($cuv);
        $lexems = Lexem::searchInflectedForms($cuv_old, $hasDiacritics, true);
    }
    if (count($lexems) == 0) {
        $searchType = SEARCH_MULTIWORD;
        $words = preg_split('/[ .-]+/', $cuv);
        if (count($words) > 1) {
            $ignoredWords = array_slice($words, 5);
            $words = array_slice($words, 0, 5);
            $definitions = Definition::searchMultipleWords($words, $hasDiacritics, $sourceId, $exclude_unofficial);
            smarty_assign('ignoredWords', $ignoredWords);
        }
    }
    if (count($lexems) == 0 && empty($definitions)) {
        $searchType = SEARCH_APPROXIMATE;
        $lexems = Lexem::searchApproximate($cuv, $hasDiacritics, true);
        if (count($lexems) == 1) {
            FlashMessage::add("Ați fost redirecționat automat la forma „{$lexems[0]->formNoAccent}”.");
        } else {
            if (!count($lexems)) {
                FlashMessage::add("Niciun rezultat relevant pentru „{$cuv}”.");
            }
        }
    }
    if (count($lexems) == 1 && $cuv != $lexems[0]->formNoAccent) {