Aggiunta indice documento per la gestione dei metadati durante l'ingestione

This commit is contained in:
andrea.terzani
2025-03-28 16:50:20 +01:00
parent 699425bc22
commit bbc08d9af6

View File

@@ -225,6 +225,7 @@ public class KSIngestor {
docs.forEach(doc -> { docs.forEach(doc -> {
List<Document> splitDocs = splitter.split(doc); List<Document> splitDocs = splitter.split(doc);
int docIndex = 0;
logger.info("Number of documents: " + splitDocs.size()); logger.info("Number of documents: " + splitDocs.size());
HashMap meta=(HashMap) ksTexts.getIngestionInfo().get("metadata"); HashMap meta=(HashMap) ksTexts.getIngestionInfo().get("metadata");
@@ -234,10 +235,15 @@ public class KSIngestor {
meta2.putAll(meta1); meta2.putAll(meta1);
meta2.put("KsInternalMainEntityId",ksTexts.getId()); meta2.put("KsInternalMainEntityId",ksTexts.getId());
meta2.put("KsExternalDocUniqueID",KsExternalDocUniqueID); meta2.put("KsExternalDocUniqueID",KsExternalDocUniqueID);
for (Document splitDoc : splitDocs) { for (Document splitDoc : splitDocs) {
meta2.put("KsDocumentUIndex",docIndex);
splitDoc.getMetadata().putAll(meta2); splitDoc.getMetadata().putAll(meta2);
docIndex++;
} }
embedtexts(splitDocs); embedtexts(splitDocs);
}); });
//ksTexts.setIngestionStatus("INGESTED"); //ksTexts.setIngestionStatus("INGESTED");
ksTexts.setIngestionDate(new Date()); ksTexts.setIngestionDate(new Date());