diff --git a/library/ZendSearch/Lucene/Search/Query/MultiTerm.php b/library/ZendSearch/Lucene/Search/Query/MultiTerm.php index d3f71db..9efe3c3 100644 --- a/library/ZendSearch/Lucene/Search/Query/MultiTerm.php +++ b/library/ZendSearch/Lucene/Search/Query/MultiTerm.php @@ -453,13 +453,16 @@ public function _conjunctionScore($docId, Lucene\SearchIndexInterface $reader) $score = 0.0; foreach ($this->_terms as $termId => $term) { - /** - * We don't need to check that term freq is not 0 - * Score calculation is performed only for matched docs - */ - $score += $reader->getSimilarity()->tf($this->_termsFreqs[$termId][$docId]) * - $this->_weights[$termId]->getValue() * - $reader->norm($docId, $term->field); + // Check if term is matched + if (isset($this->_termsFreqs[$termId][$docId])) { + /** + * We don't need to check that term freq is not 0 + * Score calculation is performed only for matched docs + */ + $score += $reader->getSimilarity()->tf($this->_termsFreqs[$termId][$docId]) * + $this->_weights[$termId]->getValue() * + $reader->norm($docId, $term->field); + } } return $score * $this->_coord * $this->getBoost();