feat: add the order of the posts according to last modify time (#5727)

* feat: add the order of the posts according to last modify time

* replace es change
pull/5520/head
Takagi 2024-04-23 11:28:53 +08:00 committed by GitHub
parent 25339c7d14
commit 944a244186
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 24 additions and 1 deletions

View File

@ -172,7 +172,12 @@ public class SchemeInitializer implements ApplicationListener<ApplicationContext
.setName("status.excerpt")
.setIndexFunc(
simpleAttribute(Post.class, post -> post.getStatusOrDefault().getExcerpt())));
indexSpecs.add(new IndexSpec()
.setName("status.lastModifyTime")
.setIndexFunc(simpleAttribute(Post.class, post -> {
var lastModifyTime = post.getStatus().getLastModifyTime();
return lastModifyTime == null ? null : lastModifyTime.toString();
})));
indexSpecs.add(new IndexSpec()
.setName(Post.REQUIRE_SYNC_ON_STARTUP_INDEX_NAME)
.setIndexFunc(simpleAttribute(Post.class, post -> {

View File

@ -420,6 +420,18 @@ watch(selectedPostNames, (newValue) => {
label: t('core.post.filters.sort.items.create_time_asc'),
value: 'metadata.creationTimestamp,asc',
},
{
label: t(
'core.post.filters.sort.items.last_modify_time_desc'
),
value: 'status.lastModifyTime,desc',
},
{
label: t(
'core.post.filters.sort.items.last_modify_time_asc'
),
value: 'status.lastModifyTime,asc',
},
{
label: t('core.post.filters.sort.items.visit_desc'),
value: 'stats.visit,desc',

View File

@ -219,6 +219,8 @@ core:
create_time_asc: Earliest Created
visit_desc: Most Visits
comment_desc: Most Comments
last_modify_time_desc: Recently Updated
last_modify_time_asc: Earliest Updated
list:
fields:
categories: "Categories:"

View File

@ -211,6 +211,8 @@ core:
create_time_asc: 较早创建
visit_desc: 最多访问量
comment_desc: 最多评论量
last_modify_time_desc: 最近更新
last_modify_time_asc: 较早更新
list:
fields:
categories: 分类:

View File

@ -211,6 +211,8 @@ core:
create_time_asc: 較早創建
visit_desc: 最多訪問量
comment_desc: 最多評論量
last_modify_time_asc: 較早更新
last_modify_time_desc: 最近更新
list:
fields:
categories: 分類: