Si je peut me permettre de proposer deux pistes:)
1-----------------------------------
tu peux récupérer tes données et en faire un tableau que tu passe à ta requête
Dans ta vue
echo $this->Form->input('termes',array('label' => false,'class'=>'search-query','type'=>'texte','placeholder'=>'Personne à rechercher','autocomplete'=>'off','escape'=>false ));
Dans ton controller
if(isset($this->request->query'data']'termes']))
{
$recherche = $this->request->query'data']'termes'];
}
$recherche = Sanitize::html($recherche, array('remove' => true));
$recherche = trim($recherche);
$recherche = explode(' ',$recherche);
$mots=array();
foreach($recherche as $mot)
{
$mots]='%'.$mot.'%';
}
et après je présume que tu peux faire
$Findpersonnes = $this->Personne->find('all', array('conditions' =>
array( 'OR' =>
array('Personne.per_nom LIKE' => $mots , 'Personne.per_prenom LIKE' => $mots))));
Bien sur c'est l'idée (sur papier si on peut dire) donc faut tester,
2-----------------------------------
sinon tu peux également sur la même base créer ta requête en bouclant sur les mots écrit et les champs ou tu veux rechercher cs mots
$recherche = Sanitize::html($recherche, array('remove' => true));
$recherche = trim($recherche);
$mots = explode(' ',$recherche);
$req='';
$champs=array('Personne.name','Personne.nom','Personne.identifiant','Personne.services','Personne.blablabla','Personne.tel','Personne.observation'); /// la tu met tes champs à toi
// ensuite on construit notre requête
foreach($mots as $mot) // pour chaque mot
{
foreach($champs as $champ) // pour chaque champ
{
$req .= $champ.' LIKE "%'.$mot.'%" OR ';
}
}
$req .= ' 1=0'; // ca c'est pour la dernière virgule de la boucle et vu que c'est un OR c'est une condition bidon
ensuite tu fais
$this->set('title_for_layout','Résultat de la recherche');
$this->Personne->recursive = 0;
$this->paginate = array(
'conditions' => array(
'OR' => array($req
)
),
'order' => 'Personne.id ASC'
);
$this->set('personnes', $this->paginate());
Puis dans ta vue tu mets un petit debug($personnes); pour voir ce que cela donne
Voila, J'espère que cela répond a tes besoins :)