getIndex() публичный Метод

Return the internal index data structure
public getIndex ( ) : array
Результат array
Пример #1
0
 /**
  * 
  * @param InvertedIndex $invertedIndex
  * @return array
  */
 public function queryIndex(InvertedIndex $invertedIndex)
 {
     $terms = array_keys($invertedIndex->getIndex());
     $found = [];
     foreach ($terms as $term) {
         foreach ($this->getQuery() as $queryTerm) {
             if (Text::contains($term, $queryTerm)) {
                 $found[$term] = $invertedIndex->getDocumentIdsByTerm($term);
             }
         }
     }
     return $found;
 }
Пример #2
0
 /**
  * @param InvertedIndex $invertedIndex
  * @return arrray
  */
 public function queryIndex(InvertedIndex $invertedIndex)
 {
     $r = $invertedIndex->getDocumentIdsByTerm($this->getQuery()[0]);
     if (!empty($r)) {
         return [$this->getQuery()[0] => $r];
     }
     // do partial matches
     $terms = array_keys($invertedIndex->getIndex());
     $found = [];
     foreach ($terms as $term) {
         if (Text::contains($term, $this->getQueryString())) {
             $found[$term] = $invertedIndex->getDocumentIdsByTerm($term);
         }
     }
     return $found;
 }