solr migration button

This commit is contained in:
Stefan Hardegger
2025-09-23 14:57:16 +02:00
parent 6ee2d67027
commit 51a1a69b45
3 changed files with 18 additions and 6 deletions

View File

@@ -291,8 +291,14 @@ public class SolrService {
// Add library ID for multi-tenant separation // Add library ID for multi-tenant separation
String currentLibraryId = getCurrentLibraryId(); String currentLibraryId = getCurrentLibraryId();
if (currentLibraryId != null) { try {
doc.addField("libraryId", currentLibraryId); 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; return doc;
@@ -330,8 +336,14 @@ public class SolrService {
// Add library ID for multi-tenant separation // Add library ID for multi-tenant separation
String currentLibraryId = getCurrentLibraryId(); String currentLibraryId = getCurrentLibraryId();
if (currentLibraryId != null) { try {
doc.addField("libraryId", currentLibraryId); 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; return doc;

View File

@@ -71,7 +71,7 @@
<field name="avatarImagePath" type="string" indexed="false" stored="true"/> <field name="avatarImagePath" type="string" indexed="false" stored="true"/>
<!-- Multi-tenant Library Separation --> <!-- Multi-tenant Library Separation -->
<field name="libraryId" type="string" indexed="true" stored="true" required="true"/> <field name="libraryId" type="string" indexed="true" stored="true" required="false" default="default"/>
<!-- Timestamp Fields --> <!-- Timestamp Fields -->
<field name="createdAt" type="pdate" indexed="true" stored="true"/> <field name="createdAt" type="pdate" indexed="true" stored="true"/>

View File

@@ -78,7 +78,7 @@
<field name="volume" type="pint" indexed="true" stored="true"/> <field name="volume" type="pint" indexed="true" stored="true"/>
<!-- Multi-tenant Library Separation --> <!-- Multi-tenant Library Separation -->
<field name="libraryId" type="string" indexed="true" stored="true" required="true"/> <field name="libraryId" type="string" indexed="true" stored="true" required="false" default="default"/>
<!-- Reading Status Fields --> <!-- Reading Status Fields -->
<field name="isRead" type="boolean" indexed="true" stored="true"/> <field name="isRead" type="boolean" indexed="true" stored="true"/>