mirror of https://github.com/halo-dev/halo
fix: missing deleted index in list method of single page finder (#6922)
#### What type of PR is this? /kind bug /area core /milestone 2.20.x #### What this PR does / why we need it: 修复使用 `singlePageFinder.list()` 时会提示缺少 spec.deleted 索引的问题 #### Which issue(s) this PR fixes: Fixes #6919 #### Does this PR introduce a user-facing change? ```release-note 修复使用 `singlePageFinder.list()` 时会提示缺少 spec.deleted 索引的问题 ```pull/6939/head
parent
7cc3dfa0a0
commit
fae03d4a5b
|
@ -13,7 +13,6 @@ import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.boot.context.event.ApplicationContextInitializedEvent;
|
import org.springframework.boot.context.event.ApplicationContextInitializedEvent;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
|
@ -288,7 +287,7 @@ public class SchemeInitializer implements ApplicationListener<ApplicationContext
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
var stats = JsonUtils.jsonToObject(statsStr, Stats.class);
|
var stats = JsonUtils.jsonToObject(statsStr, Stats.class);
|
||||||
return ObjectUtils.defaultIfNull(stats.getVisit(), 0).toString();
|
return defaultIfNull(stats.getVisit(), 0).toString();
|
||||||
})));
|
})));
|
||||||
|
|
||||||
indexSpecs.add(new IndexSpec()
|
indexSpecs.add(new IndexSpec()
|
||||||
|
@ -300,7 +299,7 @@ public class SchemeInitializer implements ApplicationListener<ApplicationContext
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
var stats = JsonUtils.jsonToObject(statsStr, Stats.class);
|
var stats = JsonUtils.jsonToObject(statsStr, Stats.class);
|
||||||
return ObjectUtils.defaultIfNull(stats.getTotalComment(), 0).toString();
|
return defaultIfNull(stats.getTotalComment(), 0).toString();
|
||||||
})));
|
})));
|
||||||
});
|
});
|
||||||
schemeManager.register(Category.class, indexSpecs -> {
|
schemeManager.register(Category.class, indexSpecs -> {
|
||||||
|
@ -497,6 +496,13 @@ public class SchemeInitializer implements ApplicationListener<ApplicationContext
|
||||||
.orElse(null))
|
.orElse(null))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
is.add(new IndexSpec()
|
||||||
|
.setName("spec.deleted")
|
||||||
|
.setIndexFunc(simpleAttribute(SinglePage.class, page -> {
|
||||||
|
var deleted = defaultIfNull(page.getSpec().getDeleted(), false);
|
||||||
|
return String.valueOf(deleted);
|
||||||
|
}))
|
||||||
|
);
|
||||||
is.add(new IndexSpec()
|
is.add(new IndexSpec()
|
||||||
.setName("spec.visible")
|
.setName("spec.visible")
|
||||||
.setIndexFunc(
|
.setIndexFunc(
|
||||||
|
|
Loading…
Reference in New Issue