diff --git a/VERSIONS_HOTLINE/49355 b/VERSIONS_HOTLINE/49355 new file mode 100644 index 0000000000000000000000000000000000000000..44210abe5eb1001fca6b674b7d8479a43b44a75e --- /dev/null +++ b/VERSIONS_HOTLINE/49355 @@ -0,0 +1 @@ + - ticket #49355 : question sur les propositions de titre via l'autocompletion \ No newline at end of file diff --git a/library/Class/Autocomplete/IndexSearcher.php b/library/Class/Autocomplete/IndexSearcher.php index 7975f7b34cfa0371c49c328a955e3ffe4acd3ab7..0ebc8e2b59bad780b080f2b5506f611c5e2fab94 100644 --- a/library/Class/Autocomplete/IndexSearcher.php +++ b/library/Class/Autocomplete/IndexSearcher.php @@ -62,7 +62,7 @@ class Class_Autocomplete_IndexSearcher { public function buildGrepCommand($search_expression) { $terms = str_replace("'", "'\''", static::extractTerms($search_expression)); - $grep_args= ["-ri -E --no-filename '(\b|'\'')" . $terms[0] . "' " . $this->base_path . "| sort --unique"]; + $grep_args= ["-ri -E --no-filename '(\b|'\'')" . $terms[0] . "' " . $this->base_path . "| sort -Vuf"]; foreach(array_slice($terms, 1) as $term) $grep_args []= "-i -E '(\b|'\'')" . $term . "'"; diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index 638873159fff4a0c7985d9b5ff0b925ed9f051c7..e816dded9512a7f9dacdb1751178b3549317f95b 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -2858,7 +2858,7 @@ class RechercheController_IndexSearcherTest extends RechercheControllerNoticeTes /** @test */ public function grepCommandForIleMaiteShouldRestrictLastResultToTen() { $this->assertEquals( - "grep -ri -E --no-filename '(\b|'\'')M[aà áâãäå][iìÃîï]t[eèéêë][eèéêë]' | sort --unique | grep -i -E '(\b|'\'')l'\''[iìÃîï]l[eèéêë]' | grep -i -E '(\b|'\'')[iìÃîï]l[eèéêë]' | grep -m 10 -i -E '(\b|'\'')d[eèéêë]'", + "grep -ri -E --no-filename '(\b|'\'')M[aà áâãäå][iìÃîï]t[eèéêë][eèéêë]' | sort -Vuf | grep -i -E '(\b|'\'')l'\''[iìÃîï]l[eèéêë]' | grep -i -E '(\b|'\'')[iìÃîï]l[eèéêë]' | grep -m 10 -i -E '(\b|'\'')d[eèéêë]'", (new Class_Autocomplete_IndexSearcher)->buildGrepCommand("l'ile dE Maitee")); }