Skip to content
Snippets Groups Projects
Commit 392be871 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #59836 use editor as alone criteria in search engine

parent 999d0866
Branches
Tags
3 merge requests!2334Master,!2301Master,!2287hotline #59836 use editor as alone criteria in search engine
Pipeline #2238 failed with stage
in 1 hour, 23 minutes, and 9 seconds
- ticket #59836 : Moteur de recherche : amélioration de la recherche d'éditeur.
\ No newline at end of file
......@@ -504,13 +504,16 @@ class Class_CriteresRecherche {
$visitor->visitExpression($expression,$this->getPertinence(),$this->getTri());
$type_recherche = $this->getTypeRecherche();
$text_inputs = ['titres', 'auteurs', 'matieres', 'dewey', 'editeur', 'collection'];
$text_inputs = ['titres', 'auteurs', 'matieres', 'dewey', 'collection'];
foreach($text_inputs as $name) {
$operateur = $this->getParam('operateur_'.$name);
if ($value = $this->getParam('rech_'.$name))
$visitor->visitTextInput($name, $operateur, $type_recherche, $value,$this->getPertinence());
}
if ($editor = $this->getParam('rech_editeur'))
$visitor->visitEditor($editor);
if ($type_doc = $this->getTypeDoc())
$visitor->visitTypeDoc($type_doc);
......
......@@ -184,6 +184,10 @@ class Class_MoteurRecherche {
$this->setCondition("annee <='" . $annee_fin . "'");
}
public function visitEditor($editor) {
$this->setCondition("editeur like '%" . str_replace('\'','%',$editor) . "%'");
}
public function visitCoteDebutFin($cote_debut, $cote_fin) {
if ($cote_debut)
......
......@@ -32,6 +32,7 @@ trait Trait_SearchCriteriaVisitor {
public function visitExpression($expression, $pertinence, $order) {}
public function visitTextInput($name, $operator, $type, $value, $pertinence) {}
public function visitTypeDoc($type) {}
public function visitEditor($editor) {}
public function visitSection($section) {}
public function visitAnnexe($annexe) {}
public function visitDigitalLib($flag) {}
......
......@@ -55,7 +55,6 @@ class ZendAfi_View_Helper_TagCriteresRecherche extends ZendAfi_View_Helper_BaseH
'auteurs' => ($libelle = Class_AdminVar::get('FACETTE_AUTEUR_LIBELLE')) ? $libelle : $this->_('Auteur'),
'matieres' => ($libelle = Class_AdminVar::get('FACETTE_MATIERE_LIBELLE')) ? $libelle : $this->_('Sujet'),
'dewey' => ($libelle = Class_AdminVar::get('FACETTE_DEWEY_LIBELLE')) ? $libelle :$this->_('Dewey / pcdm4'),
'editeur' => $this->_('Editeur'),
'collection' => $this->_('Collection') ];
if (isset($criteres_recherche))
......@@ -156,6 +155,12 @@ class ZendAfi_View_Helper_TagCriteresRecherche extends ZendAfi_View_Helper_BaseH
}
public function visitEditor($editor) {
$this->htmlAppend($this->getSuppressionImgUrlForLibelle($this->view->_('Editeur : %s', $editor),
$this->_criteres_recherche->getUrlCriteresWithoutElement('rech_editeur')));
}
public function visitCatalogue($catalogue) {
$this->htmlAppend($this->getSuppressionImgUrlForLibelle($catalogue->getLibelle(),$this->_criteres_recherche->getUrlCriteresWithoutElement('id_catalogue')));
}
......
......@@ -1717,7 +1717,7 @@ class RechercheControllerSimpleActionLibelleFacetteTest extends RechercheControl
'&operateur_dewey=and'.
'&rech_dewey=pomme'.
'&operateur_editeur=and'.
'&rech_editeur='.
'&rech_editeur=l%27ecole'.
'&operateur_collection=and'.
'&rech_collection='.
'&type_recherche=fulltext'.
......@@ -1739,11 +1739,18 @@ class RechercheControllerSimpleActionLibelleFacetteTest extends RechercheControl
/** @test */
public function criteresRechercheShouldContainsGenreMangaOrSpectacle() {
$this->assertXPathContentContains('//div[@class="criteres_recherche"]//div//a[contains(@href,"/recherche/simple/rech_auteurs/musso/rech_dewey/pomme/tri/%2A/operateur_auteurs/and/operateur_dewey/and/type_recherche/fulltext")]',
$this->assertXPathContentContains('//div[@class="criteres_recherche"]//div//a[contains(@href,"/recherche/simple/rech_auteurs/musso/rech_dewey/pomme/rech_editeur/l%27ecole/tri/%2A/operateur_editeur/and/operateur_auteurs/and/operateur_dewey/and/type_recherche/fulltext")]',
'Genre: spectacle OU Manga',$this->_response->getBody());
}
/** @test */
public function criteresRechercheShouldContainsLEcole() {
$this->assertXPathContentContains('//div[@class="criteres_recherche"]//div//a[contains(@href,"/recherche/simple/rech_auteurs/musso/rech_dewey/pomme/tri/%2A/operateur_editeur/and/operateur_auteurs/and/operateur_dewey/and/genre/1%3B19/type_recherche/fulltext")]',
'Editeur : l\'ecole',$this->_response->getBody());
}
/** @test */
public function criteresRechercheShouldContainsDEWEY() {
$this->assertXPathContentContains('//div[@class="criteres_recherche"]//div', 'DEWEY ?!@',$this->_response->getBody());
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment