@@ -310,7 +310,10 @@ private void insertField(BibEntry entry, Field field) {
310
310
FIELD_NAME ,
311
311
FIELD_VALUE_LITERAL ,
312
312
FIELD_VALUE_TRANSFORMED );
313
- // Inserts a new record into the table, or updates the existing record if there's a conflict
313
+
314
+ // Inserts or updates date-related fields (e.g., date, year, month, day) into the index.
315
+ // If a conflict occurs (e.g., the same ENTRY_ID and FIELD_NAME already exist),
316
+ // the existing values are overwritten with the new ones to ensure the latest data is stored.
314
317
String insertDateFieldQuery = """
315
318
INSERT INTO %s ("%s", "%s", "%s", "%s")
316
319
VALUES (?, ?, ?, ?)
@@ -325,8 +328,9 @@ ON CONFLICT ("%s", "%s")
325
328
ENTRY_ID , FIELD_NAME ,
326
329
FIELD_VALUE_LITERAL , FIELD_VALUE_LITERAL ,
327
330
FIELD_VALUE_TRANSFORMED , FIELD_VALUE_TRANSFORMED );
331
+
328
332
String entryId = entry .getId ();
329
- // If the updated field is date-related, re-index all date fields to overwrite the previous value .
333
+ // If the updated field is date-related,iterate through all date fields and update the index accordingly .
330
334
if (dateFields .contains (field )) {
331
335
try (PreparedStatement preparedStatement = connection .prepareStatement (insertDateFieldQuery )) {
332
336
for (Field dateField : dateFields ) {
0 commit comments