diff --git a/application/src/main/java/run/halo/app/core/extension/endpoint/StatsEndpoint.java b/application/src/main/java/run/halo/app/core/extension/endpoint/StatsEndpoint.java index c00e53062fe..2102d0bb4d9 100644 --- a/application/src/main/java/run/halo/app/core/extension/endpoint/StatsEndpoint.java +++ b/application/src/main/java/run/halo/app/core/extension/endpoint/StatsEndpoint.java @@ -4,6 +4,7 @@ import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder; import static run.halo.app.extension.index.query.QueryFactory.and; import static run.halo.app.extension.index.query.QueryFactory.equal; +import static run.halo.app.extension.index.query.QueryFactory.isNull; import lombok.Data; import org.springdoc.webflux.core.fn.SpringdocRouteBuilder; @@ -75,7 +76,7 @@ Mono getStats(ServerRequest request) { .flatMap(stats -> { var listOptions = new ListOptions(); listOptions.setFieldSelector(FieldSelector.of( - and(equal("metadata.deletionTimestamp", null), + and(isNull("metadata.deletionTimestamp"), equal("spec.deleted", "false"))) ); return client.listBy(Post.class, listOptions, PageRequestImpl.ofSize(1)) diff --git a/application/src/main/java/run/halo/app/core/extension/reconciler/CategoryReconciler.java b/application/src/main/java/run/halo/app/core/extension/reconciler/CategoryReconciler.java index 48935c569c4..bcee3e310cb 100644 --- a/application/src/main/java/run/halo/app/core/extension/reconciler/CategoryReconciler.java +++ b/application/src/main/java/run/halo/app/core/extension/reconciler/CategoryReconciler.java @@ -2,6 +2,7 @@ import static run.halo.app.extension.index.query.QueryFactory.and; import static run.halo.app.extension.index.query.QueryFactory.equal; +import static run.halo.app.extension.index.query.QueryFactory.isNull; import java.time.Duration; import java.util.ArrayDeque; @@ -146,7 +147,7 @@ private void populatePosts(Category category) { var postListOptions = new ListOptions(); postListOptions.setFieldSelector(FieldSelector.of( - and(equal("metadata.deletionTimestamp", null), + and(isNull("metadata.deletionTimestamp"), equal("spec.deleted", "false"))) ); var posts = client.listAll(Post.class, postListOptions, Sort.unsorted()); diff --git a/application/src/main/java/run/halo/app/theme/finders/impl/SiteStatsFinderImpl.java b/application/src/main/java/run/halo/app/theme/finders/impl/SiteStatsFinderImpl.java index 52f2d027944..2966f6a6263 100644 --- a/application/src/main/java/run/halo/app/theme/finders/impl/SiteStatsFinderImpl.java +++ b/application/src/main/java/run/halo/app/theme/finders/impl/SiteStatsFinderImpl.java @@ -2,6 +2,7 @@ import static run.halo.app.extension.index.query.QueryFactory.and; import static run.halo.app.extension.index.query.QueryFactory.equal; +import static run.halo.app.extension.index.query.QueryFactory.isNull; import lombok.AllArgsConstructor; import reactor.core.publisher.Mono; @@ -52,7 +53,7 @@ Mono postCount() { .eq(Post.PUBLISHED_LABEL, "true") .build()); var fieldQuery = and( - equal("metadata.deletionTimestamp", null), + isNull("metadata.deletionTimestamp"), equal("spec.deleted", "false") ); listOptions.setFieldSelector(FieldSelector.of(fieldQuery)); diff --git a/application/src/main/java/run/halo/app/theme/router/DefaultQueryPostPredicateResolver.java b/application/src/main/java/run/halo/app/theme/router/DefaultQueryPostPredicateResolver.java index cf6e8690cef..d86a393a9b8 100644 --- a/application/src/main/java/run/halo/app/theme/router/DefaultQueryPostPredicateResolver.java +++ b/application/src/main/java/run/halo/app/theme/router/DefaultQueryPostPredicateResolver.java @@ -2,6 +2,7 @@ import static run.halo.app.extension.index.query.QueryFactory.and; import static run.halo.app.extension.index.query.QueryFactory.equal; +import static run.halo.app.extension.index.query.QueryFactory.isNull; import static run.halo.app.extension.index.query.QueryFactory.or; import java.security.Principal; @@ -48,7 +49,7 @@ public Mono getListOptions() { .eq(Post.PUBLISHED_LABEL, "true").build()); var fieldQuery = and( - equal("metadata.deletionTimestamp", null), + isNull("metadata.deletionTimestamp"), equal("spec.deleted", "false") ); var visibleQuery = equal("spec.visible", Post.VisibleEnum.PUBLIC.name());