Skip to content
Snippets Groups Projects

[RTIP] hotline : #200741 : better search with domain and filtre

Merged Sebastien ANDRE requested to merge hotline#200741_lenteurs_yonne_execution_d_un_domaine into master
Viewing commit b378f3be
Show latest version
4 files
+ 18
13
Preferences
Compare changes
Files
4
@@ -165,24 +165,29 @@ class Class_CriteresRecherche_AxeParamBlock
Storm_Query_Criteria $criteria): self
{
$match = (new Storm_Query_MatchBoolean($field));
$or_matchs = new Storm_Collection;
foreach ($values as $value) {
$or_terms = new Storm_Collection;
$this->_terms
->analyse($value);
$this->_terms->analyse($value);
$pertinence = $this->_pertinence || 1 === $this->_terms->wordsCount();
$callback = ($this->_pertinence || 1 === $this->_terms->wordsCount())
$callback = $pertinence
? fn($variants) => $or_terms->addAll($variants)
: fn($variants) => $or_terms->add(Storm_Query_Terms::and($variants));
$this->_terms
->withVariantsDo($callback)
->withExactWordsDo(fn($words) => $or_terms
->add(Storm_Query_Terms::orExact($words)));
->withExactWordsDo(fn($words) => $or_terms->add(Storm_Query_Terms::andExact($words)));
if ($pertinence)
$or_matchs->addAll($or_terms->getArrayCopy());
$match->against_or($or_terms->getArrayCopy());
if ( ! $pertinence)
$or_matchs->add(Storm_Query_Terms::and($or_terms->getArrayCopy()));
}
$match->against_or($or_matchs->getArrayCopy());
$this->_applyMatchTo($match, $criteria);
return $this;