diff --git a/src/main/java/run/halo/moments/search/DocumentConverter.java b/src/main/java/run/halo/moments/search/DocumentConverter.java index 88fd70e..4f475ad 100644 --- a/src/main/java/run/halo/moments/search/DocumentConverter.java +++ b/src/main/java/run/halo/moments/search/DocumentConverter.java @@ -5,6 +5,7 @@ import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import java.util.Optional; import lombok.NonNull; import lombok.RequiredArgsConstructor; import org.springframework.core.convert.converter.Converter; @@ -41,7 +42,8 @@ public Mono convert(Moment moment) { haloDoc.setDescription(momentContent.getHtml()); haloDoc.setExposed(isExposed(moment)); haloDoc.setContent(momentContent.getHtml()); - haloDoc.setTags(moment.getSpec().getTags().stream().toList()); + var tags = moment.getSpec().getTags(); + Optional.ofNullable(tags).ifPresent((tag) -> haloDoc.setTags(tag.stream().toList())); haloDoc.setOwnerName(moment.getSpec().getOwner()); haloDoc.setUpdateTimestamp(moment.getSpec().getReleaseTime()); haloDoc.setCreationTimestamp(moment.getMetadata().getCreationTimestamp());