Exemplo n.º 1
0
 /**
  * @param $query
  * @return mixed|string
  */
 protected function sanitizeQuery($query)
 {
     $select = new Select($query);
     return $select->getSolrQuery(10);
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 protected function sanitizeQuery($query)
 {
     $select = new Select($query);
     return $select->getSolrQuery(static::WORDS_QUERY_LIMIT);
 }
Exemplo n.º 4
0
    /**
     * @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));
    }