/** * Parse a query string and store all resulting QueryTerms in an internal array. * Every query passed to a Facet or FSphinx client must be parsed in this way. * * @param string $query Query string to be parsed. * @return MultiFieldQuery Parsed query object. */ public function parse($query) { $this->_raw = $query; $this->_qts = array(); if (preg_match_all(self::QUERY_PATTERN, $query, $matches) !== false) { foreach ($matches['field'] as $index => $field) { if ($query_term = QueryTerm::fromMatchObject(array($matches['status'][$index], $field, $matches['term'][$index], $matches['all'][$index]), $this->_user_sph_map, $this->_user_attr_map)) { $this->addQueryTerm($query_term); } } } return $this; }