From 15f7617443c723b71db7b67d46cbeb0adbed1007 Mon Sep 17 00:00:00 2001 From: Patrick Barroca <pbarroca@afi-sa.fr> Date: Mon, 15 Oct 2018 14:52:29 +0200 Subject: [PATCH] dev #80530 : add index for enlarged search with other terms --- cosmogramme/sql/patch/patch_355.php | 6 +++++- tests/db/UpgradeDBTest.php | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cosmogramme/sql/patch/patch_355.php b/cosmogramme/sql/patch/patch_355.php index 357abd74e2f..3e68d803e33 100644 --- a/cosmogramme/sql/patch/patch_355.php +++ b/cosmogramme/sql/patch/patch_355.php @@ -2,6 +2,10 @@ $adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); try { $adapter->query('insert into variables(clef, commentaire, type_champ, groupe, ordre, verrou) values("other_index_fields", "Listes des champs à indexer comme termes supplémentaires, sous la forme [zone]$[champ] séparés par des points virgules. Ex: 300$a;303$a", 1, 5, 2, "checked")'); - +} catch(Exception $e) {} +try { $adapter->query("alter table notices add column other_terms text character set latin1 not null default '', add FULLTEXT KEY `other_terms` (`other_terms`)"); } catch(Exception $e) {} +try { + $adapter->query("alter table notices add FULLTEXT KEY `mots_notice_2` (`titres`,`auteurs`,`editeur`,`collection`,`matieres`,`dewey`,`other_terms`)"); +} catch(Exception $e) {} diff --git a/tests/db/UpgradeDBTest.php b/tests/db/UpgradeDBTest.php index 8ffd242c1c8..48b4d1fd308 100644 --- a/tests/db/UpgradeDBTest.php +++ b/tests/db/UpgradeDBTest.php @@ -2262,7 +2262,8 @@ class UpgradeDB_355_Test extends UpgradeDBTestCase { public function prepare() { $this ->silentQuery('delete from variables where clef="other_index_fields"') - ->silentQuery('alter table notices drop other_terms'); + ->silentQuery('alter table notices drop other_terms') + ->silentQuery('alter table notices drop index mots_notice_2'); } @@ -2280,6 +2281,12 @@ class UpgradeDB_355_Test extends UpgradeDBTestCase { } + /** @test */ + public function recordsTableMotsNotice2IndexShouldExist() { + $this->assertIndex('notices', 'mots_notice_2', 'FULLTEXT'); + } + + /** @test */ public function cosmoVarsShouldContainsOtherIndexFields() { -- GitLab