/** * @param $query * @return mixed|string */ protected function sanitizeQuery($query) { $select = new Select($query); return $select->getSolrQuery(10); }
/** * Receives a possibly dirty user input string and stores it in an * instance of Wikia\Search\Query\Select. * Uses the methods within that class to determine if we need to * record a specific namespace associated with that query. * * @param string $query * @return \Wikia\Search\Config provides fluent interface */ public function setQuery($query) { $this->query = new Query($query); $namespace = $this->query->getNamespaceId(); if ($namespace !== null) { $namespaces = $this->getNamespaces(); if (empty($namespaces) || !in_array($namespace, $namespaces)) { $this->queryNamespace = $namespace; } } return $this; }
protected function sanitizeQuery($query) { $select = new Select($query); return $select->getSolrQuery(static::WORDS_QUERY_LIMIT); }
/** * @group Slow * @slowExecutionTime 0.09074 ms */ public function testGetSolrQueryWithWordLimit() { $query = <<<YEEZY Uh:my mind move like a Tron bike Uh, pop a wheelie on the Zeitgeist Uh, I'm finna start a new movement YEEZY; $q = new Query($query); $this->assertEquals('Uh\\:my mind move like a Tron bike Uh, pop a', $q->getSolrQuery(10)); $sQuery = 'test'; $q = new Query($sQuery); $this->assertEquals($sQuery, $q->getSolrQuery(10)); }