/** * @see getTables() * * @param MingoTable $table * @return array */ protected function _getTables(MingoTable $table = null) { $query = ''; $val_list = array(); if (empty($table)) { $query = 'SELECT tablename FROM pg_tables'; } else { $query = 'SELECT tablename FROM pg_tables WHERE tablename = ?'; $val_list = array($table->getName()); } //if/else $ret_list = $this->_getQuery($query, $val_list); return $ret_list; }
/** * get the actual lucene instance for the $table * * @param string $table * @return Zend_Search_Lucene_Proxy */ protected function getLucene(MingoTable $table) { $table_name = $table->getName(); // canary... if (isset($this->con_db[$table_name])) { return $this->con_db[$table_name]; } //if $ret_instance = null; $path = array(); $path[] = $this->getField('path'); $path[] = $table_name; $index_path = join(DIRECTORY_SEPARATOR, $path); try { // install the index if it doesn't already exist... if (is_dir($index_path)) { $ret_instance = Zend_Search_Lucene::open($index_path); } else { $ret_instance = Zend_Search_Lucene::create($index_path); } //if/else } catch (Zend_Search_Lucene_Exception $e) { clearstatcache(); usleep(10); $ret_instance = Zend_Search_Lucene::create($index_path); } //try/catch if ($ret_instance !== null) { // set some values... /* Matlin on #phpc turned me onto MaxMergeDocs, MergeFactor, MaxBufferedDocs as probably the cause for the weird http 500 timeout issues I have when adding to the index */ $ret_instance->setMaxMergeDocs((int) $this->max_merged_docs); $ret_instance->setMaxBufferedDocs((int) $this->max_buffered_docs); $ret_instance->setMergeFactor((int) $this->merge_factor); // treat numbers like words, don't worry about case // see: http://framework.zend.com/manual/en/zend.search.lucene.charset.html 38.6.2.... Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive()); // default to and, instead of or, when there is no operator... // http://framework.zend.com/manual/en/zend.search.lucene.query-language.html#zend.search.lucene.query-language.boolean.no-operator Zend_Search_Lucene_Search_QueryParser::setDefaultOperator(Zend_Search_Lucene_Search_QueryParser::B_AND); } else { throw new UnexpectedValueException('could not create Lucene connection'); } //if/else $this->con_db[$table_name] = $ret_instance; return $ret_instance; }
/** * get the index table name * * @param \MingoTable $table * @param \MingoIndex $index * @return string the index table name */ protected function getIndexTableName(MingoTable $table, MingoIndex $index) { $table_name = sprintf('%s_%s', $table->getName(), $index->getName()); return $table_name; }