From b22793f21a009b1e35a6c9892871a2314bf27e20 Mon Sep 17 00:00:00 2001 From: Moctar Date: Thu, 24 Oct 2019 18:06:50 +0200 Subject: [PATCH 1/5] add missing cache directory --- cache/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 cache/.gitkeep diff --git a/cache/.gitkeep b/cache/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 From cba5f8a1a2ecb908d96128146f7c4253e431b2e9 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Thu, 7 Nov 2019 17:24:57 +0100 Subject: [PATCH 2/5] PHRAS-2815_generate-cterms-multi-db_4.1 fix : the "generate cterms" setting is applied by db how : the "global_structure" (fields merged) now also contains field settings by db --- .../Indexer/Record/Hydrator/ThesaurusHydrator.php | 14 +++++++++----- .../SearchEngine/Elastic/Structure/Field.php | 13 +++++++++++++ .../Elastic/Structure/GlobalStructure.php | 15 +++++++++++++++ 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/ThesaurusHydrator.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/ThesaurusHydrator.php index 6f6c502151..d8076b2922 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/ThesaurusHydrator.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/ThesaurusHydrator.php @@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Hydrator; use Alchemy\Phrasea\SearchEngine\Elastic\Exception\Exception; use Alchemy\Phrasea\SearchEngine\Elastic\RecordHelper; +use Alchemy\Phrasea\SearchEngine\Elastic\Structure\GlobalStructure; use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus; use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus\CandidateTerms; use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus\Concept; @@ -27,7 +28,7 @@ class ThesaurusHydrator implements HydratorInterface private $thesaurus; private $candidate_terms; - public function __construct(Structure $structure, Thesaurus $thesaurus, CandidateTerms $candidate_terms) + public function __construct(GlobalStructure $structure, Thesaurus $thesaurus, CandidateTerms $candidate_terms) { $this->structure = $structure; $this->thesaurus = $thesaurus; @@ -67,7 +68,13 @@ class ThesaurusHydrator implements HydratorInterface $terms = array(); $filters = array(); $field_names = array(); + /** @var Field[] $dbFields */ + $dbFields = $this->structure->getAllFieldsByDatabox($record['databox_id']); foreach ($fields as $name => $field) { + if(!array_key_exists($name, $dbFields) || !$dbFields[$name]->get_generate_cterms()) { + continue; + } + $root_concepts = $field->getThesaurusRoots(); // Loop through all values to prepare bulk query $field_values = \igorw\get_in($record, explode('.', $index_fields[$name])); @@ -98,10 +105,7 @@ class ThesaurusHydrator implements HydratorInterface } } else { - $field = $fields[$name]; - if($field->get_generate_cterms()) { - $this->candidate_terms->insert($field_names[$offset], $values[$offset]); - } + $this->candidate_terms->insert($field_names[$offset], $values[$offset]); } } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/Field.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/Field.php index f2dc5d0e7b..5333da5ab4 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/Field.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/Field.php @@ -24,6 +24,11 @@ class Field implements Typed */ private $name; + /** + * @var int + */ + private $databox_id; + /** * @var string */ @@ -73,6 +78,7 @@ class Field implements Typed } return new self($field->get_name(), $type, [ + 'databox_id' => $databox->get_sbas_id(), 'searchable' => $field->is_indexable(), 'private' => $field->isBusiness(), 'facet' => $facet, @@ -102,6 +108,7 @@ class Field implements Typed { $this->name = (string) $name; $this->type = $type; + $this->databox_id = \igorw\get_in($options, ['databox_id'], 0); $this->is_searchable = \igorw\get_in($options, ['searchable'], true); $this->is_private = \igorw\get_in($options, ['private'], false); $this->facet = \igorw\get_in($options, ['facet']); @@ -126,6 +133,7 @@ class Field implements Typed public function withOptions(array $options) { return new self($this->name, $this->type, $options + [ + 'databox_id' => $this->databox_id, 'searchable' => $this->is_searchable, 'private' => $this->is_private, 'facet' => $this->facet, @@ -155,6 +163,11 @@ class Field implements Typed return sprintf('concept_path.%s', $this->name); } + public function get_databox_id() + { + return $this->databox_id; + } + public function getType() { return $this->type; diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/GlobalStructure.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/GlobalStructure.php index 912bbe934a..ea4022dffb 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/GlobalStructure.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/GlobalStructure.php @@ -14,6 +14,12 @@ final class GlobalStructure implements Structure */ private $fields = array(); + + /** + * @var Field[][] + */ + private $fieldsByDatabox = []; + /** * @var Field[] * */ @@ -119,6 +125,10 @@ final class GlobalStructure implements Structure public function add(Field $field) { + // store info for each field, not still merged by databox + $this->fieldsByDatabox[$field->get_databox_id()][$field->getName()] = $field; + + // store merged infos (same field name) $name = $field->getName(); if (isset($this->fields[$name])) { @@ -152,6 +162,11 @@ final class GlobalStructure implements Structure return $this->fields; } + public function getAllFieldsByDatabox($databox_id) + { + return $this->fieldsByDatabox[$databox_id]; + } + /** * @return Field[] */ From 38e7f6038f9f7049292b056b664d1abdd1c30f57 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Thu, 7 Nov 2019 17:50:50 +0100 Subject: [PATCH 3/5] PHRAS-2815_generate-cterms-multi-db_4.1 fix unit test --- .../Tests/Phrasea/SearchEngine/Structure/StructureTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/Structure/StructureTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/Structure/StructureTest.php index 4f6edc5a9b..27f01811c1 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/Structure/StructureTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/Structure/StructureTest.php @@ -36,6 +36,7 @@ class StructureTest extends \PHPUnit_Framework_TestCase $field->isFacet()->willReturn(false); $field->hasConceptInference()->willReturn(false); $field->getDependantCollections()->willReturn(['1']); + $field->get_databox_id()->willReturn('1'); $structure->add($field->reveal()); $this->assertCount(1, $structure->getAllFields()); @@ -60,6 +61,7 @@ class StructureTest extends \PHPUnit_Framework_TestCase $field->isPrivate()->willReturn(false); $field->isFacet()->willReturn(false); $field->hasConceptInference()->willReturn(false); + $field->get_databox_id()->willReturn('1'); $other = new Field('foo', FieldMapping::TYPE_STRING); From 1260e87d8b41f6e59c1b77946246a95b8c3bcee5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2019 13:20:08 +0000 Subject: [PATCH 4/5] Bump lodash.merge from 4.6.1 to 4.6.2 Bumps [lodash.merge](https://github.com/lodash/lodash) from 4.6.1 to 4.6.2. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/commits) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5c3543a4d1..cfd05aa243 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5978,9 +5978,9 @@ lodash.keys@~2.4.1: lodash.isobject "~2.4.1" lodash.merge@^4.6.0: - version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.1.tgz#adc25d9cb99b9391c59624f379fbba60d7111d54" - integrity sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ== + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== lodash.restparam@^3.0.0: version "3.6.1" From d4de76662ff83e26ebc59092be135a10255e9a4a Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Wed, 13 Nov 2019 18:37:02 +0400 Subject: [PATCH 5/5] PHRAS-2760 #comment close submenu on click a div out of this #time 1h --- templates/web/common/menubar.html.twig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/templates/web/common/menubar.html.twig b/templates/web/common/menubar.html.twig index 3821f42e79..772a86c497 100644 --- a/templates/web/common/menubar.html.twig +++ b/templates/web/common/menubar.html.twig @@ -302,8 +302,18 @@ $(document).ready(function () { $('body').on('click', '#help-trigger', function (event) { $('#mainMenu .helpcontextmenu').toggleClass('shown'); - console.log('mety'); + }); + + $(document).on('click', function (e) { + if($('#mainMenu .helpcontextmenu').hasClass('shown')) { + var $this = $(e.target); + if ($this.closest('#mainMenu .helpcontextmenu.shown, .help-trigger').length == 0 && $this[0].id != "toggle") { + $('#mainMenu .helpcontextmenu').removeClass('shown'); + } + } + }); + // var key = 'help'; var configurationSettingLinks = {{ configuration|json_encode|raw }}; //seperate array based on location of link