diff --git a/EMS/core-bundle/src/Form/Field/FilterOptionsType.php b/EMS/core-bundle/src/Form/Field/FilterOptionsType.php index 60d3c006b..f25fdb5c2 100644 --- a/EMS/core-bundle/src/Form/Field/FilterOptionsType.php +++ b/EMS/core-bundle/src/Form/Field/FilterOptionsType.php @@ -6,6 +6,7 @@ use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -34,6 +35,9 @@ class FilterOptionsType extends AbstractType 'asciifolding' => [ 'preserve_original', ], + 'synonym' => [ + 'synonyms', + ], ]; /** @@ -50,6 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'Stemmer' => 'stemmer', 'Elision' => 'elision', 'ASCII Folding' => 'asciifolding', + 'Synonym' => 'synonym', ], 'attr' => [ 'class' => 'fields-to-display-by-input-value', @@ -174,6 +179,19 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ])->add('articles', TextareaType::class, [ 'attr' => ['class' => 'filter_option fields-to-display-for fields-to-display-for-elision'], 'required' => false, + ])->add('synonyms', CollectionType::class, [ + 'entry_type' => TextType::class, + 'attr' => [ + 'class' => 'a2lix_lib_sf_collection filter_option fields-to-display-for fields-to-display-for-synonym', + 'data-lang-add' => 'Add synonyms', + 'data-lang-remove' => 'X', + 'data-entry-remove-class' => 'btn btn-danger', + ], + 'entry_options' => [ + 'label' => false, + ], + 'allow_add' => true, + 'allow_delete' => true, ]); $textArea2Array = new CallbackTransformer( diff --git a/demo/configs/admin/analyzer/dutch_for_highlighting.json b/demo/configs/admin/analyzer/dutch_for_highlighting.json index a91d2920a..7d7b4551c 100644 --- a/demo/configs/admin/analyzer/dutch_for_highlighting.json +++ b/demo/configs/admin/analyzer/dutch_for_highlighting.json @@ -19,7 +19,7 @@ "type": "custom", "tokenizer": "standard" }, - "orderKey": 2 + "orderKey": 3 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/analyzer/dutch_with_synonyms.json b/demo/configs/admin/analyzer/dutch_with_synonyms.json new file mode 100644 index 000000000..494ffec9f --- /dev/null +++ b/demo/configs/admin/analyzer/dutch_with_synonyms.json @@ -0,0 +1,24 @@ +{ + "class": "EMS\\CoreBundle\\Entity\\Analyzer", + "arguments": [], + "properties": { + "name": "dutch_with_synonyms", + "dirty": true, + "label": "Dutch (synonyms)", + "options": { + "filter": [ + "standard", + "lowercase", + "dutch_stemmer", + "dutch_stop", + "empty_elision", + "business_synonyms" + ], + "char_filter": [], + "type": "custom", + "tokenizer": "standard" + }, + "orderKey": 2 + }, + "replaced": [] +} \ No newline at end of file diff --git a/demo/configs/admin/analyzer/english_for_highlighting.json b/demo/configs/admin/analyzer/english_for_highlighting.json index 817728de4..2e1808eaf 100644 --- a/demo/configs/admin/analyzer/english_for_highlighting.json +++ b/demo/configs/admin/analyzer/english_for_highlighting.json @@ -19,7 +19,7 @@ "type": "custom", "tokenizer": "standard" }, - "orderKey": 3 + "orderKey": 5 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/analyzer/english_with_synonyms.json b/demo/configs/admin/analyzer/english_with_synonyms.json new file mode 100644 index 000000000..18186541f --- /dev/null +++ b/demo/configs/admin/analyzer/english_with_synonyms.json @@ -0,0 +1,24 @@ +{ + "class": "EMS\\CoreBundle\\Entity\\Analyzer", + "arguments": [], + "properties": { + "name": "english_with_synonyms", + "dirty": true, + "label": "English (synonyms)", + "options": { + "filter": [ + "standard", + "lowercase", + "empty_elision", + "english_stemmer", + "english_stop", + "business_synonyms" + ], + "char_filter": [], + "type": "custom", + "tokenizer": "standard" + }, + "orderKey": 4 + }, + "replaced": [] +} \ No newline at end of file diff --git a/demo/configs/admin/analyzer/french_for_highlighting.json b/demo/configs/admin/analyzer/french_for_highlighting.json index 5efa6c6d4..483ce13de 100644 --- a/demo/configs/admin/analyzer/french_for_highlighting.json +++ b/demo/configs/admin/analyzer/french_for_highlighting.json @@ -8,9 +8,9 @@ "options": { "filter": [ "standard", - "asciifolding", "lowercase", "french_elision", + "french_stop", "french_stemmer", "french_stop" ], @@ -20,7 +20,7 @@ "type": "custom", "tokenizer": "standard" }, - "orderKey": 4 + "orderKey": 7 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/analyzer/french_with_synonyms.json b/demo/configs/admin/analyzer/french_with_synonyms.json new file mode 100644 index 000000000..875ed753f --- /dev/null +++ b/demo/configs/admin/analyzer/french_with_synonyms.json @@ -0,0 +1,24 @@ +{ + "class": "EMS\\CoreBundle\\Entity\\Analyzer", + "arguments": [], + "properties": { + "name": "french_with_synonyms", + "dirty": true, + "label": "French (synonyms)", + "options": { + "filter": [ + "standard", + "lowercase", + "french_elision", + "french_stop", + "french_stemmer", + "business_synonyms" + ], + "char_filter": [], + "type": "custom", + "tokenizer": "standard" + }, + "orderKey": 6 + }, + "replaced": [] +} \ No newline at end of file diff --git a/demo/configs/admin/analyzer/german_for_highlighting.json b/demo/configs/admin/analyzer/german_for_highlighting.json index 1601b9bab..ef3acaf3a 100644 --- a/demo/configs/admin/analyzer/german_for_highlighting.json +++ b/demo/configs/admin/analyzer/german_for_highlighting.json @@ -19,7 +19,7 @@ "type": "custom", "tokenizer": "standard" }, - "orderKey": 5 + "orderKey": 9 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/analyzer/german_with_synonyms.json b/demo/configs/admin/analyzer/german_with_synonyms.json new file mode 100644 index 000000000..8ed14f8b1 --- /dev/null +++ b/demo/configs/admin/analyzer/german_with_synonyms.json @@ -0,0 +1,24 @@ +{ + "class": "EMS\\CoreBundle\\Entity\\Analyzer", + "arguments": [], + "properties": { + "name": "german_with_synonyms", + "dirty": true, + "label": "German (synonyms)", + "options": { + "filter": [ + "standard", + "lowercase", + "empty_elision", + "german_stemmer", + "german_stop", + "business_synonyms" + ], + "char_filter": [], + "type": "custom", + "tokenizer": "standard" + }, + "orderKey": 8 + }, + "replaced": [] +} \ No newline at end of file diff --git a/demo/configs/admin/analyzer/html_strip.json b/demo/configs/admin/analyzer/html_strip.json index 900658a67..aca7cdb27 100644 --- a/demo/configs/admin/analyzer/html_strip.json +++ b/demo/configs/admin/analyzer/html_strip.json @@ -15,7 +15,7 @@ "type": "custom", "tokenizer": "standard" }, - "orderKey": 6 + "orderKey": 10 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/analyzer/standard_with_synonyms.json b/demo/configs/admin/analyzer/standard_with_synonyms.json new file mode 100644 index 000000000..b6a39d53b --- /dev/null +++ b/demo/configs/admin/analyzer/standard_with_synonyms.json @@ -0,0 +1,21 @@ +{ + "class": "EMS\\CoreBundle\\Entity\\Analyzer", + "arguments": [], + "properties": { + "name": "standard_with_synonyms", + "dirty": true, + "label": "Standard (with synonyms)", + "options": { + "type": "custom", + "tokenizer": "standard", + "char_filter": [], + "filter": [ + "standard", + "lowercase", + "business_synonyms" + ] + }, + "orderKey": 11 + }, + "replaced": [] +} \ No newline at end of file diff --git a/demo/configs/admin/filter/business_synonyms.json b/demo/configs/admin/filter/business_synonyms.json new file mode 100644 index 000000000..01874ad2e --- /dev/null +++ b/demo/configs/admin/filter/business_synonyms.json @@ -0,0 +1,18 @@ +{ + "class": "EMS\\CoreBundle\\Entity\\Filter", + "arguments": [], + "properties": { + "name": "business_synonyms", + "dirty": true, + "label": "business_synonyms", + "options": { + "type": "synonym", + "synonyms": [ + "ipod, i-pod, i pod", + "ElasticMS, Elastic MS" + ] + }, + "orderKey": 1 + }, + "replaced": [] +} \ No newline at end of file diff --git a/demo/configs/admin/filter/dutch_stemmer.json b/demo/configs/admin/filter/dutch_stemmer.json index 44a27b619..255804883 100644 --- a/demo/configs/admin/filter/dutch_stemmer.json +++ b/demo/configs/admin/filter/dutch_stemmer.json @@ -9,7 +9,7 @@ "type": "stemmer", "name": "dutch" }, - "orderKey": 1 + "orderKey": 3 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/dutch_stop.json b/demo/configs/admin/filter/dutch_stop.json index 46fced333..5c17ec4e7 100644 --- a/demo/configs/admin/filter/dutch_stop.json +++ b/demo/configs/admin/filter/dutch_stop.json @@ -11,7 +11,7 @@ "type": "stop", "ignore_case": false }, - "orderKey": 2 + "orderKey": 4 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/empty_elision.json b/demo/configs/admin/filter/empty_elision.json index 098b52dc9..715da2810 100644 --- a/demo/configs/admin/filter/empty_elision.json +++ b/demo/configs/admin/filter/empty_elision.json @@ -12,7 +12,7 @@ "type": "elision", "articles_case": false }, - "orderKey": 3 + "orderKey": 2 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/english_stemmer.json b/demo/configs/admin/filter/english_stemmer.json index 47f6720a6..1fc4f34e5 100644 --- a/demo/configs/admin/filter/english_stemmer.json +++ b/demo/configs/admin/filter/english_stemmer.json @@ -9,7 +9,7 @@ "type": "stemmer", "name": "english" }, - "orderKey": 4 + "orderKey": 5 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/english_stop.json b/demo/configs/admin/filter/english_stop.json index 5c416970c..6394a12c3 100644 --- a/demo/configs/admin/filter/english_stop.json +++ b/demo/configs/admin/filter/english_stop.json @@ -11,7 +11,7 @@ "type": "stop", "ignore_case": false }, - "orderKey": 5 + "orderKey": 6 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/french_elision.json b/demo/configs/admin/filter/french_elision.json index 29706606d..812b5ccd8 100644 --- a/demo/configs/admin/filter/french_elision.json +++ b/demo/configs/admin/filter/french_elision.json @@ -24,7 +24,7 @@ "type": "elision", "articles_case": false }, - "orderKey": 6 + "orderKey": 7 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/french_stemmer.json b/demo/configs/admin/filter/french_stemmer.json index 94b045e74..a8627bf55 100644 --- a/demo/configs/admin/filter/french_stemmer.json +++ b/demo/configs/admin/filter/french_stemmer.json @@ -9,7 +9,7 @@ "type": "stemmer", "name": "light_french" }, - "orderKey": 7 + "orderKey": 8 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/french_stop.json b/demo/configs/admin/filter/french_stop.json index b62cac44c..280adee20 100644 --- a/demo/configs/admin/filter/french_stop.json +++ b/demo/configs/admin/filter/french_stop.json @@ -11,7 +11,7 @@ "type": "stop", "ignore_case": false }, - "orderKey": 8 + "orderKey": 9 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/german_stemmer.json b/demo/configs/admin/filter/german_stemmer.json index 30e172454..ac9c0978f 100644 --- a/demo/configs/admin/filter/german_stemmer.json +++ b/demo/configs/admin/filter/german_stemmer.json @@ -9,7 +9,7 @@ "type": "stemmer", "name": "light_german" }, - "orderKey": 9 + "orderKey": 10 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/filter/german_stop.json b/demo/configs/admin/filter/german_stop.json index f3cbb8ad7..cf7070929 100644 --- a/demo/configs/admin/filter/german_stop.json +++ b/demo/configs/admin/filter/german_stop.json @@ -11,7 +11,7 @@ "type": "stop", "ignore_case": false }, - "orderKey": 10 + "orderKey": 11 }, "replaced": [] } \ No newline at end of file diff --git a/demo/configs/admin/form/search_fields.json b/demo/configs/admin/form/search_fields.json index 9509ffcc4..a57f40536 100644 --- a/demo/configs/admin/form/search_fields.json +++ b/demo/configs/admin/form/search_fields.json @@ -81,7 +81,7 @@ }, "mappingOptions": { "index": null, - "analyzer": "french", + "analyzer": "french_with_synonyms", "copy_to": "live_search_fr" }, "restrictionOptions": { @@ -156,7 +156,7 @@ }, "mappingOptions": { "index": null, - "analyzer": "dutch", + "analyzer": "dutch_with_synonyms", "copy_to": "live_search_nl" }, "restrictionOptions": { @@ -227,7 +227,7 @@ "displayTemplate": null }, "mappingOptions": { - "mappingOptions": "{\r\n \"type\": \"text\",\r\n \"analyzer\": \"french\",\r\n \"copy_to\": [\r\n \"live_search_fr\"\r\n ]\r\n}", + "mappingOptions": "{\r\n \"type\": \"text\",\r\n \"analyzer\": \"french_with_synonyms\",\r\n \"copy_to\": [\r\n \"live_search_fr\"\r\n ]\r\n}", "copy_to": null }, "restrictionOptions": [], @@ -263,7 +263,7 @@ "displayTemplate": null }, "mappingOptions": { - "mappingOptions": "{\r\n \"type\": \"text\",\r\n \"analyzer\": \"dutch\",\r\n \"copy_to\": [\r\n \"live_search_nl\"\r\n ]\r\n}", + "mappingOptions": "{\r\n \"type\": \"text\",\r\n \"analyzer\": \"dutch_with_synonyms\",\r\n \"copy_to\": [\r\n \"live_search_nl\"\r\n ]\r\n}", "copy_to": null }, "restrictionOptions": [], @@ -299,7 +299,7 @@ "displayTemplate": null }, "mappingOptions": { - "mappingOptions": "{\r\n \"type\": \"search_as_you_type\",\r\n \"analyzer\": \"standard\"\r\n}", + "mappingOptions": "{\r\n \"type\": \"search_as_you_type\",\r\n \"analyzer\": \"standard_with_synonyms\"\r\n}", "copy_to": null }, "restrictionOptions": [], @@ -335,7 +335,7 @@ "displayTemplate": null }, "mappingOptions": { - "mappingOptions": "{\r\n \"type\": \"search_as_you_type\",\r\n \"analyzer\": \"french\"\r\n}", + "mappingOptions": "{\r\n \"type\": \"search_as_you_type\",\r\n \"analyzer\": \"french_with_synonyms\"\r\n}", "copy_to": null }, "restrictionOptions": [], @@ -371,7 +371,7 @@ "displayTemplate": null }, "mappingOptions": { - "mappingOptions": "{\r\n \"type\": \"search_as_you_type\",\r\n \"analyzer\": \"dutch\"\r\n}", + "mappingOptions": "{\r\n \"type\": \"search_as_you_type\",\r\n \"analyzer\": \"dutch_with_synonyms\"\r\n}", "copy_to": null }, "restrictionOptions": [],