예제 #1
0
 public function __construct()
 {
     parent::__construct();
     $this->opo_db = new Db();
     $this->opo_tep = new TimeExpressionParser();
     $this->opo_geocode_parser = new GeocodeAttributeValue();
 }
예제 #2
0
 public function __construct($po_db = null)
 {
     parent::__construct($po_db);
     // allow overriding settings from search.conf via constant (usually defined in bootstrap file)
     // this is useful for multi-instance setups which have the same set of config files for multiple instances
     if (defined('__CA_ELASTICSEARCH_BASE_URL__') && strlen(__CA_ELASTICSEARCH_BASE_URL__) > 0) {
         $this->ops_elasticsearch_base_url = __CA_ELASTICSEARCH_BASE_URL__;
     } else {
         $this->ops_elasticsearch_base_url = $this->opo_search_config->get('search_elasticsearch_base_url');
     }
     if (defined('__CA_ELASTICSEARCH_INDEX_NAME__') && strlen(__CA_ELASTICSEARCH_INDEX_NAME__) > 0) {
         $this->ops_elasticsearch_index_name = __CA_ELASTICSEARCH_INDEX_NAME__;
     } else {
         $this->ops_elasticsearch_index_name = $this->opo_search_config->get('search_elasticsearch_index_name');
     }
     $this->opo_client = Elasticsearch\ClientBuilder::create()->setHosts([$this->ops_elasticsearch_base_url])->setRetries(2)->build();
 }
예제 #3
0
파일: Solr.php 프로젝트: kai-iak/pawtucket2
 public function __construct()
 {
     parent::__construct();
     $this->opo_db = new Db();
     $this->opo_tep = new TimeExpressionParser();
     $this->opo_geocode_parser = new GeocodeAttributeValue();
     // allow overriding settings from search.conf via constant (usually defined in bootstrap file)
     // this is useful for multi-instance setups which have the same set of config files for multiple instances
     if (defined('__CA_SOLR_URL__') && strlen(__CA_SOLR_URL__) > 0) {
         $this->ops_search_solr_url = __CA_SOLR_URL__;
     } else {
         $this->ops_search_solr_url = $this->opo_search_config->get('search_solr_url');
     }
     if (defined('__CA_SOLR_HOME_DIR__') && strlen(__CA_SOLR_HOME_DIR__) > 0) {
         $this->ops_search_solr_home_dir = __CA_SOLR_HOME_DIR__;
     } else {
         $this->ops_search_solr_home_dir = $this->opo_search_config->get('search_solr_home_dir');
     }
 }
예제 #4
0
 public function __construct()
 {
     parent::__construct();
     $this->opo_db = new Db();
     $this->opo_tep = new TimeExpressionParser();
     $this->opo_geocode_parser = new GeocodeAttributeValue();
     // allow overriding settings from search.conf via constant (usually defined in bootstrap file)
     // this is useful for multi-instance setups which have the same set of config files for multiple instances
     if (defined('__CA_ELASTICSEARCH_BASE_URL__') && strlen(__CA_ELASTICSEARCH_BASE_URL__) > 0) {
         $this->ops_elasticsearch_base_url = __CA_ELASTICSEARCH_BASE_URL__;
     } else {
         $this->ops_elasticsearch_base_url = $this->opo_search_config->get('search_elasticsearch_base_url');
     }
     if (defined('__CA_ELASTICSEARCH_INDEX_NAME__') && strlen(__CA_ELASTICSEARCH_INDEX_NAME__) > 0) {
         $this->ops_elasticsearch_index_name = __CA_ELASTICSEARCH_INDEX_NAME__;
     } else {
         $this->ops_elasticsearch_index_name = $this->opo_search_config->get('search_elasticsearch_index_name');
     }
 }
예제 #5
0
 public function __construct()
 {
     parent::__construct();
     $this->opo_tep = new TimeExpressionParser();
     $this->ops_lookup_word_sql = "\n\t\t\tSELECT word_id \n\t\t\tFROM ca_sql_search_words\n\t\t\tWHERE\n\t\t\t\tword = ?\n\t\t";
     $this->opqr_lookup_word = $this->opo_db->prepare($this->ops_lookup_word_sql);
     $this->ops_insert_word_index_sql = "\n\t\t\tINSERT  INTO ca_sql_search_word_index\n\t\t\t(table_num, row_id, field_table_num, field_num, field_row_id, word_id, boost, access)\n\t\t\tVALUES\n\t\t";
     $this->ops_insert_word_sql = "\n\t\t\tINSERT  INTO ca_sql_search_words\n\t\t\t(word, stem)\n\t\t\tVALUES\n\t\t\t(?, ?)\n\t\t";
     $this->ops_insert_ngram_sql = "\n\t\t\tINSERT  INTO ca_sql_search_ngrams\n\t\t\t(word_id, ngram, seq)\n\t\t\tVALUES\n\t\t";
     $this->opqr_insert_word = $this->opo_db->prepare($this->ops_insert_word_sql);
     $this->ops_delete_sql = "DELETE FROM ca_sql_search_word_index WHERE (table_num = ?) AND (row_id = ?)";
     $this->opqr_delete = $this->opo_db->prepare($this->ops_delete_sql);
     $this->ops_delete_with_field_num_sql = "DELETE FROM ca_sql_search_word_index WHERE (table_num = ?) AND (row_id = ?) AND (field_table_num = ?) AND (field_num = ?)";
     $this->opqr_delete_with_field_num = $this->opo_db->prepare($this->ops_delete_with_field_num_sql);
     $this->ops_delete_with_field_row_id_sql = "DELETE FROM ca_sql_search_word_index WHERE (table_num = ?) AND (row_id = ?) AND (field_table_num = ?) AND (field_row_id = ?)";
     $this->opqr_delete_with_field_row_id = $this->opo_db->prepare($this->ops_delete_with_field_row_id_sql);
     $this->ops_delete_with_field_row_id_and_num = "DELETE FROM ca_sql_search_word_index WHERE (table_num = ?) AND (row_id = ?) AND (field_table_num = ?) AND (field_num = ?) AND (field_row_id = ?)";
     $this->opqr_delete_with_field_row_id_and_num = $this->opo_db->prepare($this->ops_delete_with_field_row_id_and_num);
     $this->ops_delete_dependent_sql = "DELETE FROM ca_sql_search_word_index WHERE (field_table_num = ?) AND (field_row_id = ?)";
     $this->opqr_delete_dependent_sql = $this->opo_db->prepare($this->ops_delete_dependent_sql);
     $this->opo_stemmer = new SnoballStemmer();
     $this->opb_do_stemming = (int) trim($this->opo_search_config->get('search_sql_search_do_stemming')) ? true : false;
     if (!($this->ops_indexing_tokenizer_regex = trim($this->opo_search_config->get('indexing_tokenizer_regex')))) {
         $this->ops_indexing_tokenizer_regex = "^\\pL\\pN\\pNd/_#\\@\\&\\.";
     }
     if (!($this->ops_search_tokenizer_regex = trim($this->opo_search_config->get('search_tokenizer_regex')))) {
         $this->ops_search_tokenizer_regex = "^\\pL\\pN\\pNd/_#\\@\\&";
     }
     if (!is_array($this->opa_asis_regexes = $this->opo_search_config->getList('asis_regexes'))) {
         $this->opa_asis_regexes = array();
     }
     //$this->opqr_insert_ngram = $this->opo_db->prepare($this->ops_insert_ngram_sql);
     //
     // Load info about metadata elements into static var cache if it hasn't already be fetched
     //
     if (!is_array(WLPlugSearchEngineSqlSearch::$s_metadata_elements)) {
         WLPlugSearchEngineSqlSearch::$s_metadata_elements = ca_metadata_elements::getRootElementsAsList();
     }
     $this->debug = false;
 }
예제 #6
0
 /**
  * Set database connection
  *
  * @param Db $po_db A database connection to use in place of current one
  */
 public function setDb($po_db)
 {
     parent::setDb($po_db);
     $this->initDbStatements();
 }