From 51a1a69b451d8e0c7d89b711cd4112455540585f Mon Sep 17 00:00:00 2001 From: Stefan Hardegger Date: Tue, 23 Sep 2025 14:57:16 +0200 Subject: [PATCH] solr migration button --- .../com/storycove/service/SolrService.java | 20 +++++++++++++++---- solr/authors/conf/managed-schema | 2 +- solr/stories/conf/managed-schema | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/com/storycove/service/SolrService.java b/backend/src/main/java/com/storycove/service/SolrService.java index a820c2c..e87aa04 100644 --- a/backend/src/main/java/com/storycove/service/SolrService.java +++ b/backend/src/main/java/com/storycove/service/SolrService.java @@ -291,8 +291,14 @@ public class SolrService { // Add library ID for multi-tenant separation String currentLibraryId = getCurrentLibraryId(); - if (currentLibraryId != null) { - doc.addField("libraryId", currentLibraryId); + try { + if (currentLibraryId != null) { + doc.addField("libraryId", currentLibraryId); + } + } catch (Exception e) { + // If libraryId field doesn't exist, log warning and continue without it + // This allows indexing to work even if schema migration hasn't completed + logger.warn("Could not add libraryId field to document (field may not exist in schema): {}", e.getMessage()); } return doc; @@ -330,8 +336,14 @@ public class SolrService { // Add library ID for multi-tenant separation String currentLibraryId = getCurrentLibraryId(); - if (currentLibraryId != null) { - doc.addField("libraryId", currentLibraryId); + try { + if (currentLibraryId != null) { + doc.addField("libraryId", currentLibraryId); + } + } catch (Exception e) { + // If libraryId field doesn't exist, log warning and continue without it + // This allows indexing to work even if schema migration hasn't completed + logger.warn("Could not add libraryId field to document (field may not exist in schema): {}", e.getMessage()); } return doc; diff --git a/solr/authors/conf/managed-schema b/solr/authors/conf/managed-schema index 15a57ec..bfa701e 100755 --- a/solr/authors/conf/managed-schema +++ b/solr/authors/conf/managed-schema @@ -71,7 +71,7 @@ - + diff --git a/solr/stories/conf/managed-schema b/solr/stories/conf/managed-schema index c0cfaab..21f220a 100755 --- a/solr/stories/conf/managed-schema +++ b/solr/stories/conf/managed-schema @@ -78,7 +78,7 @@ - +