_term = $term; $this->_field = $field; } /** * Process modifier ('~') * * @param mixed $parameter */ public function processFuzzyProximityModifier($parameter = null) { $this->_fuzzyQuery = true; if ($parameter !== null) { $this->_similarity = $parameter; } else { /** Zend_Search_Lucene_Search_Query_Fuzzy */ #require_once 'Zend/Search/Lucene/Search/Query/Fuzzy.php'; $this->_similarity = Zend_Search_Lucene_Search_Query_Fuzzy::DEFAULT_MIN_SIMILARITY; } } /** * Transform entry to a subquery * * @param string $encoding * @return Zend_Search_Lucene_Search_Query * @throws Zend_Search_Lucene_Search_QueryParserException */ public function getQuery($encoding) { if ($this->_fuzzyQuery) { /** Zend_Search_Lucene_Search_Query_Preprocessing_Fuzzy */ #require_once 'Zend/Search/Lucene/Search/Query/Preprocessing/Fuzzy.php'; $query = new Zend_Search_Lucene_Search_Query_Preprocessing_Fuzzy($this->_term, $encoding, ($this->_field !== null)? iconv($encoding, 'UTF-8', $this->_field) : null, $this->_similarity ); $query->setBoost($this->_boost); return $query; } /** Zend_Search_Lucene_Search_Query_Preprocessing_Term */ #require_once 'Zend/Search/Lucene/Search/Query/Preprocessing/Term.php'; $query = new Zend_Search_Lucene_Search_Query_Preprocessing_Term($this->_term, $encoding, ($this->_field !== null)? iconv($encoding, 'UTF-8', $this->_field) : null ); $query->setBoost($this->_boost); return $query; } }