factory() public static method

public static factory ( string $queryString ) : QueryAbstractFactory
$queryString string
return QueryAbstractFactory
コード例 #1
0
 /**
  * Accepts a string a query and returns the set of documents relevant 
  * to the query
  * @param string $queryStr
  * @return array 
  */
 public function query($queryStr)
 {
     $queryObj = QueryAbstractFactory::factory($queryStr);
     if ($queryObj instanceof SingleTermQuery && isset($this->index[$queryObj->getQuery()])) {
         return $this->index[$queryObj->getQuery()][self::POSTINGS];
     } else {
         if ($queryObj instanceof MultiTermQuery) {
             return $this->getMultiTermResults($queryObj->getQuery());
         }
     }
     //no results available
     return array();
 }
コード例 #2
0
 /**
  * Accepts a string a query and returns the set of documents relevant 
  * to the query
  * @param string $queryStr
  * @return array 
  */
 public function query($queryStr)
 {
     return QueryAbstractFactory::factory($queryStr)->queryIndex($this);
 }