Refonte EntryManager::search

REFACTORYSATION DE LA METHODE EntryManager::search

Document de travail en cours - contact@yvesgufflet.fr

  • Objectifs :
    éliminer les bugs liés à la modification du nommage automatique des champs liste…
    éliminer les expressions regulière tarabiscottée
    améliorer la justesse des recherches
    améliorer le support des expressionns régulières
    ajouter des opérateurs : == !=, <, >, …

/////////////////////////
// FONCTIONNEMENT ACTUEL
/////////////////////////

OPERATEURS D’EXPRESSION

| correspond à AND
, correspond à OR

OPERATEURS DE COMPARAISON

!=

ALGORITHME ET UTILISATION

EntryController::formatQuery : sert à préparer la query pour EntryManager::search
+ combine la query passée en arguments avec la query contenue dans la requete HTTP
+ si 2 champs se retrouvent avec le meme opérateur dans des clauses AND, ils sont regroupés dans une clause OR

EntryController::formatQuery est utilisé par :

+ tools/bazar/controllers/ApiController.php:53:       $query = $this->getService(EntryController::class)->formatQuery(
+ tools/bazar/actions/BazarCartoAction.php:54:        $query = $this->getService(EntryController::class)->formatQuery($arg, $_GET);
+ tools/bazar/actions/BazarListeAction.php:153:       'query' => $this->getService(EntryController::class)->formatQuery($arg, $_GET),

EntryController::formatQuery n’est pas utilisée par tools/bazar/handlers/RSSHandler.php
NOTE : RSSHandler.php ne regroupe pas, en une seule clause OR, 2 champs qui se retrouvent avec le meme opérateur dans des clauses AND

+ tools/bazar/presentation/javascripts/entries-index-dynamic.js
	parseSearchParams

	mergeSearchParams

/////////////////////////
// FONCTIONNEMENT PREVU
/////////////////////////

OPERATEURS D’EXPRESSION

| correspond à AND
, correspond à OR

ALGORITHME ET UTILISATION

+ EntryController::formatQuery ne regroupe plus, en une seule clause OR, 2 champs qui se retrouvent avec le meme opérateur dans des clauses AND différentes

Elle simplifie juste la query en rassemblant les conditions quand c’est possible

+ tools/bazar/handlers/RSSHandler.php utilise EntryController::formatQuery

+ tools/bazar/presentation/javascripts/entries-index-dynamic.js

OPERATEURS DE COMPARAISON

= ==
!= !=
== ===
!== !==
< <
<= <=

  >

= >=

CONVERSION AUTOMATIQUE AVEC L’ANCIENNE SYNTAXE (RETROCOMPATIBILITE)
= ==
!= != (inchangé)

FILTRAGE D’UN CHAMP MULTIPLE (ex : checkboxes)


OPERATEUR =


=> Application avec AND : f=toto|f=titi

VALUE							RESULTAT
----------------------------------------
tata, tete, titi, toto, tutu	VRAI
tata, titi, tutu				FAUX
tata, toto, tutu				FAUX
titi, toto, tutu				VRAI
titi							FAUX
toto							FAUX
tata, tete, tutu				FAUX

=> Application avec OR : f=toto,titi

VALUE							RESULTAT
----------------------------------------
tata, tete, titi, toto, tutu	VRAI
tata, titi, tutu				VRAI
tata, toto, tutu				VRAI
titi, toto, tutu				VRAI
titi							VRAI
toto							VRAI
tata, tete, tutu				FAUX

OPERATEUR !=


=> Application avec AND : f!=toto|f!=titi

VALUE							RESULTAT
----------------------------------------
tata, tete, titi, toto, tutu	FAUX
tata, titi, tutu				FAUX
tata, toto, tutu				FAUX
titi, toto, tutu				FAUX
titi							FAUX
toto							FAUX
tata, tete, tutu				VRAI

=> Application avec OR : f!=toto,titi

VALUE							RESULTAT
----------------------------------------	
tata, tete, titi, toto, tutu	FAUX
tata, titi, tutu				VRAI
tata, toto, tutu				VRAI
titi, toto, tutu				FAUX
titi							VRAI
toto							VRAI
tata, tete, tutu				VRAI
1 « J'aime »