From cac080f5d59360460b8d4a87979b914bed608094 Mon Sep 17 00:00:00 2001 From: Stefan Hoffmeister Date: Mon, 3 Nov 2025 13:58:37 +0100 Subject: [PATCH 1/2] Do not attempt to add null content to Lucene index --- .../io/kafbat/ui/service/index/LuceneTopicsIndex.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java b/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java index 4aa344331..2a399578b 100644 --- a/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java +++ b/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java @@ -15,6 +15,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Function; import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -40,6 +41,7 @@ import org.apache.lucene.store.ByteBuffersDirectory; import org.apache.lucene.store.Directory; +@Slf4j public class LuceneTopicsIndex implements TopicsIndex { public static final String FIELD_NAME_RAW = "name_raw"; @@ -74,9 +76,15 @@ private Directory build(List topics) { doc.add(new LongPoint(FIELD_SIZE, topic.getSegmentSize())); if (topic.getTopicConfigs() != null && !topic.getTopicConfigs().isEmpty()) { for (InternalTopicConfig topicConfig : topic.getTopicConfigs()) { - if (topicConfig.getName() != null || topicConfig.getValue() != null) { + final String topicConfigValue = topicConfig.getValue(); + if (topicConfigValue != null) { doc.add(new StringField(FIELD_CONFIG_PREFIX + "_" + topicConfig.getName(), topicConfig.getValue(), Field.Store.NO)); + } else { + log.warn( + "Topic configuration item '{}' on internal topic '{}' has an unexpected value of null" + + "; skipping processing", topicConfig.getName(), topic.getName() + ); } } } From a901bc2b69629011566c7644f2f81c71cab3d05b Mon Sep 17 00:00:00 2001 From: Stefan Hoffmeister Date: Wed, 5 Nov 2025 08:25:44 +0100 Subject: [PATCH 2/2] fixup! Do not attempt to add null content to Lucene index --- .../main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java b/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java index 2a399578b..43e850288 100644 --- a/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java +++ b/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java @@ -81,7 +81,7 @@ private Directory build(List topics) { doc.add(new StringField(FIELD_CONFIG_PREFIX + "_" + topicConfig.getName(), topicConfig.getValue(), Field.Store.NO)); } else { - log.warn( + log.info( "Topic configuration item '{}' on internal topic '{}' has an unexpected value of null" + "; skipping processing", topicConfig.getName(), topic.getName() );