diff --git a/pom.xml b/pom.xml
index 05aaeaa..346c957 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
it.eng.dome
search
- 1.5.0
+ 1.5.1
Search and Browsing
Demo for DOME Project
diff --git a/release_note.md b/release_note.md
index 084e8f9..4afd495 100644
--- a/release_note.md
+++ b/release_note.md
@@ -2,6 +2,10 @@
**Release Notes** for the *Search*:
+### 1.5.1
+**Bug Fix**
+* Data Normalization: Resolved an inconsistency in the normalization logic within the ResultProcessor. By ensuring uniform handling of strings (specifically case-insensitive transformation) during the retrieval phase, the system now guarantees accurate and predictable sorting for the name field.
+
### 1.5.0
**Improvement**
* Dynamic Sorting: Implemented support for dynamic search result sorting. The SearchProduct and SearchProvider APIs now support sorting parameters via query string (e.g., ?sort=field,asc/desc).
diff --git a/src/main/java/it/eng/dome/search/config/IndexInitializer.java b/src/main/java/it/eng/dome/search/config/IndexInitializer.java
new file mode 100644
index 0000000..f8be665
--- /dev/null
+++ b/src/main/java/it/eng/dome/search/config/IndexInitializer.java
@@ -0,0 +1,39 @@
+package it.eng.dome.search.config;
+
+import it.eng.dome.search.domain.IndexingObject;
+import it.eng.dome.search.domain.ProviderIndex;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
+import org.springframework.data.elasticsearch.core.IndexOperations;
+import org.springframework.data.elasticsearch.core.document.Document;
+
+import javax.annotation.PostConstruct;
+
+@Configuration
+public class IndexInitializer {
+
+ private final ElasticsearchOperations elasticsearchOperations;
+ private final Logger logger = LoggerFactory.getLogger(IndexInitializer.class);
+
+ public IndexInitializer(ElasticsearchOperations elasticsearchOperations) {
+ this.elasticsearchOperations = elasticsearchOperations;
+ }
+
+ @PostConstruct
+ public void configureIndices() {
+ setupIndex(IndexingObject.class);
+ setupIndex(ProviderIndex.class);
+ }
+
+ private void setupIndex(Class> clazz) {
+ IndexOperations indexOps = elasticsearchOperations.indexOps(clazz);
+ if (!indexOps.exists()) {
+ String jsonSettings = "{\"analysis\": {\"normalizer\": {\"lowercase_normalizer\": {\"type\": \"custom\",\"filter\": [\"lowercase\"]}}}}";
+ indexOps.create(Document.parse(jsonSettings));
+ indexOps.putMapping(indexOps.createMapping(clazz));
+ logger.info("Indice per {} creato con normalizer personalizzato.", clazz.getSimpleName());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/it/eng/dome/search/domain/IndexingObject.java b/src/main/java/it/eng/dome/search/domain/IndexingObject.java
index 9d124f2..d7550c8 100644
--- a/src/main/java/it/eng/dome/search/domain/IndexingObject.java
+++ b/src/main/java/it/eng/dome/search/domain/IndexingObject.java
@@ -33,7 +33,7 @@ public class IndexingObject {
@Field(type = FieldType.Text)
private String productOfferingDescription;
- @Field(type = FieldType.Keyword)
+ @Field(type = FieldType.Keyword, normalizer = "lowercase_normalizer")
private String productOfferingName;
@Field(type = FieldType.Text)
diff --git a/src/main/java/it/eng/dome/search/domain/ProviderIndex.java b/src/main/java/it/eng/dome/search/domain/ProviderIndex.java
index 0754c83..1186dfb 100644
--- a/src/main/java/it/eng/dome/search/domain/ProviderIndex.java
+++ b/src/main/java/it/eng/dome/search/domain/ProviderIndex.java
@@ -22,7 +22,7 @@ public class ProviderIndex {
@Id
protected String id;
- @Field(type = FieldType.Keyword)
+ @Field(type = FieldType.Keyword, normalizer = "lowercase_normalizer")
private String tradingName;
@Field(type = FieldType.Text)