From f615fc8eab1c94380d385927aa7890c0d95d551e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20B?= <stephane.bouvry@unicaen.fr>
Date: Wed, 27 Sep 2023 16:19:35 +0200
Subject: [PATCH] =?UTF-8?q?Fix=20:=20Erreur=20ElasticSearch=20(probl=C3=A8?=
 =?UTF-8?q?me=20de=20compatibilit=C3=A9=20dans=20le=20mapping=20des=20cham?=
 =?UTF-8?q?ps)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Search/OrganizationElasticSearch.php      | 144 +++++++++---------
 1 file changed, 72 insertions(+), 72 deletions(-)

diff --git a/module/Oscar/src/Oscar/Strategy/Search/OrganizationElasticSearch.php b/module/Oscar/src/Oscar/Strategy/Search/OrganizationElasticSearch.php
index 414a888f0..f41e9dc29 100644
--- a/module/Oscar/src/Oscar/Strategy/Search/OrganizationElasticSearch.php
+++ b/module/Oscar/src/Oscar/Strategy/Search/OrganizationElasticSearch.php
@@ -265,77 +265,77 @@ class OrganizationElasticSearch implements OrganizationSearchStrategy
         } catch (\Exception $e) {
             throw $e;
         }
-
-        try {
-            $this->getClient()->indices()->create(
-                [
-                    'index' => $this->getIndex(),
-                    'body' => [
-                        'settings' => [
-                            'analysis' => [
-                                'analyzer' => [
-                                    'noaccent' => [
-                                        "type" => "custom",
-                                        "tokenizer" => "standard",
-                                        "filter" => ['asciifolding', "lowercase"]
-                                    ]
-                                ],
-                            ]
-                        ],
-                        'mappings' => [
-                            "organization" => [
-                                'properties' => [
-                                    'code' => [
-                                        'type' => 'keyword',
-                                    ],
-                                    'shortname' => [
-                                        'type' => 'text',
-//                                        'analyzer' => 'noaccent'
-                                    ],
-                                    'fullname' => [
-//                                        'analyzer' => 'noaccent',
-                                        'type' => 'text',
-                                    ],
-                                    'description' => [
-//                                        'analyzer' => 'noaccent',
-                                        'type' => 'text',
-                                    ],
-                                    'email' => [
-//                                        'analyzer' => 'noaccent',
-                                        'type' => 'text',
-                                    ],
-                                    'city' => [
-//                                        'analyzer' => 'noaccent',
-                                        'type' => 'text',
-                                    ],
-                                    'siret' => [
-                                        'type' => 'keyword',
-                                    ],
-                                    'country' => [
-                                        'type' => 'keyword',
-                                    ],
-                                    'connectors' => [
-                                        'type' => 'keyword',
-                                    ],
-                                    'zipcode' => [
-                                        'type' => 'keyword',
-                                    ],
-                                    'persons' => [
-//                                        'analyzer' => 'noaccent',
-                                        'type' => 'text',
-                                    ],
-                                    'activities' => [
-//                                        'analyzer' => 'noaccent',
-                                        'type' => 'text',
-                                    ],
-                                ]
-                            ]
-                        ]
-                    ]
-                ]
-            );
-        } catch (\Exception $e) {
-            throw new OscarException("Impossible de créer l'index de recherche : \n---\n" . $e->getMessage());
-        }
+//
+//        try {
+//            $this->getClient()->indices()->create(
+//                [
+//                    'index' => $this->getIndex(),
+//                    'body' => [
+//                        'settings' => [
+//                            'analysis' => [
+//                                'analyzer' => [
+//                                    'noaccent' => [
+//                                        "type" => "custom",
+//                                        "tokenizer" => "standard",
+//                                        "filter" => ['asciifolding', "lowercase"]
+//                                    ]
+//                                ],
+//                            ]
+//                        ],
+//                        'mappings' => [
+//                            "organization" => [
+//                                'properties' => [
+//                                    'code' => [
+//                                        'type' => 'keyword',
+//                                    ],
+//                                    'shortname' => [
+//                                        'type' => 'text',
+////                                        'analyzer' => 'noaccent'
+//                                    ],
+//                                    'fullname' => [
+////                                        'analyzer' => 'noaccent',
+//                                        'type' => 'text',
+//                                    ],
+//                                    'description' => [
+////                                        'analyzer' => 'noaccent',
+//                                        'type' => 'text',
+//                                    ],
+//                                    'email' => [
+////                                        'analyzer' => 'noaccent',
+//                                        'type' => 'text',
+//                                    ],
+//                                    'city' => [
+////                                        'analyzer' => 'noaccent',
+//                                        'type' => 'text',
+//                                    ],
+//                                    'siret' => [
+//                                        'type' => 'keyword',
+//                                    ],
+//                                    'country' => [
+//                                        'type' => 'keyword',
+//                                    ],
+//                                    'connectors' => [
+//                                        'type' => 'keyword',
+//                                    ],
+//                                    'zipcode' => [
+//                                        'type' => 'keyword',
+//                                    ],
+//                                    'persons' => [
+////                                        'analyzer' => 'noaccent',
+//                                        'type' => 'text',
+//                                    ],
+//                                    'activities' => [
+////                                        'analyzer' => 'noaccent',
+//                                        'type' => 'text',
+//                                    ],
+//                                ]
+//                            ]
+//                        ]
+//                    ]
+//                ]
+//            );
+//        } catch (\Exception $e) {
+//            throw new OscarException("Impossible de créer l'index de recherche : \n---\n" . $e->getMessage());
+//        }
     }
 }
\ No newline at end of file
-- 
GitLab