public static function searchFullText($words, $hasDiacritics)
 {
     $intersection = null;
     $matchingLexems = array();
     foreach ($words as $word) {
         $lexems = Lexem::searchInflectedForms($word, $hasDiacritics);
         $lexemIds = array();
         foreach ($lexems as $lexem) {
             $lexemIds[] = $lexem->id;
         }
         $matchingLexems[] = $lexemIds;
     }
     foreach ($words as $i => $word) {
         // Load all the definitions for any possible lexem for this word.
         $lexemIds = $matchingLexems[$i];
         $defIds = FullTextIndex::loadDefinitionIdsForLexems($lexemIds);
         DebugInfo::resetClock();
         $intersection = $intersection === null ? $defIds : util_intersectArrays($intersection, $defIds);
         DebugInfo::stopClock("Intersected with lexems for {$word}");
     }
     if ($intersection === null) {
         // This can happen when the query is all stopwords
         $intersection = array();
     }
     $shortestInvervals = array();
     DebugInfo::resetClock();
     // Now compute a score for every definition
     foreach ($intersection as $defId) {
         // Compute the position matrix (for every word, load all the matching
         // positions)
         $p = array();
         foreach ($matchingLexems as $lexemIds) {
             $p[] = FullTextIndex::loadPositionsByLexemIdsDefinitionId($lexemIds, $defId);
         }
         $shortestIntervals[] = util_findSnippet($p);
     }
     if ($intersection) {
         array_multisort($shortestIntervals, $intersection);
     }
     DebugInfo::stopClock("Computed score for every definition");
     return $intersection;
 }