src/wcmf/lib/search/impl/LuceneSearch.php
private function getIndex($create = true) {
    if (!$this->index || $create) {
      $indexPath = $this->getIndexPath();

      $analyzer = new LuceneUtf8Analyzer();

      // add stop words filter
      $stopWords = $this->getStopWords();
      $stopWordsFilter = new StopWords($stopWords);
      $analyzer->addFilter($stopWordsFilter);

      Analyzer::setDefault($analyzer);
      Wildcard::setMinPrefixLength(0);
      QueryParser::setDefaultEncoding('UTF-8');
      QueryParser::setDefaultOperator(QueryParser::B_AND);

      try {
        $this->index = Lucene::open($indexPath);
        //$this->index->setMaxMergeDocs(5);
        //$this->index->setMergeFactor(5);
      }
      catch (\Exception $ex) {
        $this->index = $this->resetIndex();
      }
    }
    return $this->index;
  }
private function getIndex($create = true) {
    if (!$this->index || $create) {
      $indexPath = $this->getIndexPath();

      $analyzer = new LuceneUtf8Analyzer();

      // add stop words filter
      $stopWords = $this->getStopWords();
      $stopWordsFilter = new StopWords($stopWords);
      $analyzer->addFilter($stopWordsFilter);

      Analyzer::setDefault($analyzer);
      Wildcard::setMinPrefixLength(0);
      QueryParser::setDefaultEncoding('UTF-8');
      QueryParser::setDefaultOperator(QueryParser::B_AND);

      try {
        $this->index = Lucene::open($indexPath);
        //$this->index->setMaxMergeDocs(5);
        //$this->index->setMergeFactor(5);
      }
      catch (\Exception $ex) {
        $this->index = $this->resetIndex();
      }
    }
    return $this->index;
  }
private function getIndex ( $ create = true ) { if ( ! $ this -> index || $ create ) { $ indexPath = $ this -> getIndexPath ( ) ; $ analyzer = new LuceneUtf8Analyzer ( ) ; // add stop words filter $ stopWords = $ this -> getStopWords ( ) ; $ stopWordsFilter = new StopWords ( $ stopWords ) ; $ analyzer -> addFilter ( $ stopWordsFilter ) ; Analyzer :: setDefault ( $ analyzer ) ; Wildcard :: setMinPrefixLength ( 0 ) ; QueryParser :: setDefaultEncoding ( 'UTF-8' ) ; QueryParser :: setDefaultOperator ( QueryParser :: B_AND ) ; try { $ this -> index = Lucene :: open ( $ indexPath ) ; //$this->index->setMaxMergeDocs(5); //$this->index->setMergeFactor(5); } catch ( \ Exception $ ex ) { $ this -> index = $ this -> resetIndex ( ) ; } } return $ this -> index ; }
Get the search index.
@param $create Boolean whether to create the index, if it does not exist (default: _true_)
@return An instance of ZendSearch/SearchIndexInterface or null
Get the search index .