Subversion Repositories eFlore/Applications.del

Rev

Rev 1892 | Rev 1913 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1892 Rev 1912
Line 448... Line 448...
448
			if (isset($this->parametres['masque.tag_cel']['AND'])) {
448
			if (isset($this->parametres['masque.tag_cel']['AND'])) {
449
				$tags = $this->parametres['masque.tag_cel']['AND'];
449
				$tags = $this->parametres['masque.tag_cel']['AND'];
450
				$clausesWhere = array();
450
				$clausesWhere = array();
451
				foreach ($tags as $tag) {
451
				foreach ($tags as $tag) {
452
					$tagMotif = $this->bdd->proteger("%$tag%");
452
					$tagMotif = $this->bdd->proteger("%$tag%");
-
 
453
					// WARNING : la sous-requête est la meilleure solution trouvée pour contrer le fonctionnement
-
 
454
					// étrange de l'optimiseur de MYSQL 5.6 (à retester avec Mysql 5.7 et suivant).
-
 
455
					$sousRequete = 'SELECT DISTINCT ce_observation '.
-
 
456
						'FROM del_image '.
-
 
457
						"WHERE mots_cles_texte LIKE $tagMotif ".
-
 
458
						'AND ce_observation IS NOT NULL';
453
					$sqlTpl = "CONCAT(IFNULL(do.mots_cles_texte,''),IFNULL(di.mots_cles_texte,'')) LIKE %s";
459
					$sql = " (do.mots_cles_texte LIKE $tagMotif OR do.id_observation IN ($sousRequete)) ";
454
					$clausesWhere[] = sprintf($sqlTpl, $tagMotif);
460
					$clausesWhere[] = $sql;
455
				}
461
				}
456
				$whereTags = implode(' AND ', $clausesWhere);
462
				$whereTags = implode(' AND ', $clausesWhere);
457
				$this->addWhere('masque.tag_cel', "($whereTags)");
463
				$this->addWhere('masque.tag_cel', "($whereTags)");
458
			} else if (isset($this->parametres['masque.tag_cel']['OR'])) {
464
			} else if (isset($this->parametres['masque.tag_cel']['OR'])) {
459
				$tags = $this->parametres['masque.tag_cel']['OR'];
465
				$tags = $this->parametres['masque.tag_cel']['OR'];