fillIndex($object_id); } } protected function delete_index($object_id,$datatype="all"){ global $dbh; //qu'est-ce qu'on efface? if($datatype=='all') { $req_del="delete from ".$this->table_prefix."_mots_global_index where id_notice='".$object_id."' "; pmb_mysql_query($req_del,$dbh); //la table pour les recherche exacte $req_del="delete from ".$this->table_prefix."_fields_global_index where id_notice='".$object_id."' "; pmb_mysql_query($req_del,$dbh); }else{ foreach($this->datatypes as $xml_datatype=> $codes){ if($xml_datatype == $datatype){ foreach($codes as $code_champ){ $req_del="delete from ".$this->table_prefix."_mots_global_index where id_notice='".$object_id."' and code_champ='".$code_champ."'"; pmb_mysql_query($req_del,$dbh); //la table pour les recherche exacte $req_del="delete from ".$this->table_prefix."_fields_global_index where id_notice='".$object_id."' and code_champ='".$code_champ."'"; pmb_mysql_query($req_del,$dbh); } } } } } public function delete_objects_index($objects_ids=array(),$datatype="all"){ global $dbh; //on s'assure qu'on a lu le XML et initialisé ce qu'il faut... if(!$this->initialized) { $this->init(); } $req_del="delete ".$this->table_prefix."_global_index from ".$this->table_prefix."_global_index ".gen_where_in('num_notice', $objects_ids); pmb_mysql_query($req_del,$dbh); //qu'est-ce qu'on efface? if($datatype=='all') { $join_temporary_table = gen_where_in('id_notice', $objects_ids); $req_del="delete ".$this->table_prefix."_mots_global_index from ".$this->table_prefix."_mots_global_index ".$join_temporary_table; pmb_mysql_query($req_del,$dbh); //la table pour les recherche exacte $req_del="delete ".$this->table_prefix."_fields_global_index from ".$this->table_prefix."_fields_global_index ".$join_temporary_table; pmb_mysql_query($req_del,$dbh); }else{ foreach($this->datatypes as $xml_datatype=> $codes){ if($xml_datatype == $datatype){ $join_temporary_table = gen_where_in('id_notice', $objects_ids); $req_del="delete ".$this->table_prefix."_mots_global_index from ".$this->table_prefix."_mots_global_index ".$join_temporary_table." where code_champ in (".implode(',', $codes).")"; pmb_mysql_query($req_del,$dbh); //la table pour les recherche exacte $req_del="delete ".$this->table_prefix."_fields_global_index from ".$this->table_prefix."_fields_global_index ".$join_temporary_table." where code_champ in (".implode(',', $codes).")"; pmb_mysql_query($req_del,$dbh); } } } } //compile les tableaux et lance les requetes protected function save_elements($tab_insert, $tab_field_insert){ global $dbh; if($tab_insert && count($tab_insert)){ $req_insert="insert into ".$this->table_prefix."_mots_global_index(id_notice,code_champ,code_ss_champ,num_word,pond,position,field_position) values ".implode(',',$tab_insert)." ON DUPLICATE KEY UPDATE num_word = num_word"; pmb_mysql_query($req_insert,$dbh); } if($tab_field_insert && count($tab_field_insert)){ //la table pour les recherche exacte $req_insert="insert into ".$this->table_prefix."_fields_global_index(id_notice,code_champ,code_ss_champ,ordre,value,lang,pond,authority_num) values ".implode(',',$tab_field_insert)." ON DUPLICATE KEY UPDATE value = value"; pmb_mysql_query($req_insert,$dbh); } } }