Nest extraData by section for clearer embedding content

Homebox's location fields were flattened into single-purpose keys
(locationName/locationDescription), which gave EmbeddingService no
way to group related fields when rendering vector-store content.
extraData is now Map<String, Map<String, Object>>, letting
HomeboxItemClient express "location" as its own section; buildExtraData
renders each section as a header with indented fields instead of a flat
"Extradata: key: value" line.
This commit is contained in:
2026-07-21 01:04:19 +02:00
parent 29027d4515
commit 3736cc73ae
5 changed files with 36 additions and 18 deletions
@@ -1,6 +1,6 @@
package com.vaessl.app.homebox;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
@@ -73,12 +73,18 @@ public class HomeboxItemClient {
String description = i.description();
HomeboxParent parent = i.parent();
Map<String, Object> extraData = new HashMap<>();
Map<String, Map<String, Object>> extraData = new LinkedHashMap<>();
Map<String, Object> locationData = new LinkedHashMap<>();
if (parent.name() != null && !parent.name().isBlank()) {
extraData.put("locationName", parent.name());
locationData.put("name", parent.name());
}
if (parent.description() != null && !parent.description().isBlank()) {
extraData.put("locationDescription", parent.description());
locationData.put("description", parent.description());
}
if (locationData != null && !locationData.isEmpty()) {
extraData.put("location", locationData);
}
return new ServiceItem(id, title, description, extraData);