authority_type = AUT_TABLE_CONCEPT; $this->searcher_authorities_skos_concept = new searcher_autorities_skos_concepts($user_query); $this->searcher_authorities_skos_concept->add_fields_restrict($this->field_restrict); $this->object_index_key= "id_item"; $this->object_words_table = "skos_words_global_index"; $this->object_fields_table = "skos_fields_global_index"; } public function _get_search_type(){ return parent::_get_search_type()."_concepts"; } public function get_raw_query() { // TODO gérer un selecteur de schéma dans authorities.xml, pour l'instant on regarde dans tous les schémas global $concept_scheme; $concept_scheme = -1; return 'select '.$this->object_key.' from ('.$this->searcher_authorities_skos_concept->get_raw_query().') as uni join authorities on uni.'.$this->searcher_authorities_skos_concept->object_key.' = authorities.num_object and type_object = '.$this->authority_type; } public function get_pert_result($query = false) { global $dbh; $this->table_tempo = ''; if ($this->searcher_authorities_skos_concept->get_result() && ($this->user_query != '*')) { $pert_result = $this->searcher_authorities_skos_concept->get_pert_result($query); if ($query) { return 'select '.$this->object_key.', pert from ('.$pert_result.') as uni join authorities on uni.'.$this->searcher_authorities_skos_concept->object_key.' = authorities.num_object and type_object = '.$this->authority_type; } $this->table_tempo = $this->get_temporary_table_name(); $pert_result = 'select '.$this->object_key.', pert from '.$pert_result.' join authorities on '.$pert_result.'.'.$this->searcher_authorities_skos_concept->object_key.' = authorities.num_object and type_object = '.$this->authority_type; $rqt = 'create temporary table '.$this->table_tempo.' '.$pert_result; $res = pmb_mysql_query($rqt,$dbh); pmb_mysql_query('alter table '.$this->table_tempo.' add index i_id('.$this->object_key.')',$dbh); } return $this->table_tempo; } protected function _get_pert($return_query = false) { return $this->get_pert_result($return_query); } protected function get_full_results_query(){ return ' SELECT DISTINCT id_authority FROM authorities JOIN skos_fields_global_index ON id_item = num_object AND code_champ = 1 AND type_object = 10 ORDER BY value '; } public function get_full_query(){ if($this->user_query !== '*' && $this->get_result()){ $query = $this->_get_pert(true); } else if($this->user_query !== '*' && $this->get_result() === ''){ return ' SELECT DISTINCT id_authority FROM authorities JOIN skos_fields_global_index ON id_item = num_object AND code_champ = 1 AND type_object = 10 where id_authority = 0'; } else { $query = $this->get_full_results_query(); } return $query; } }