diff --git a/src/meilisearch_endpoint/index.ts b/src/meilisearch_endpoint/index.ts index a95204a..cc181c4 100644 --- a/src/meilisearch_endpoint/index.ts +++ b/src/meilisearch_endpoint/index.ts @@ -131,7 +131,16 @@ export default defineEndpoint({ const queryFields = buildQueryFields(fields); const itemService = new ItemsService(cfg.collection_name, { schema }); - const items = await itemService.readByQuery({ fields: queryFields, limit: -1 }); + const items = await itemService.readByQuery({ + fields: queryFields, + filter: { + _or: [ + { status: { _neq: 'archived' } }, + { status: { _null: true } } + ] + }, + limit: -1, + }); // 为每种语言重建索引 for (const lang of availableLanguages) { diff --git a/src/meilisearch_hook/index.ts b/src/meilisearch_hook/index.ts index f79c679..f1c5fd6 100644 --- a/src/meilisearch_hook/index.ts +++ b/src/meilisearch_hook/index.ts @@ -157,15 +157,15 @@ export default defineHook(async ({ init, filter, action, schedule }, { services, const queryFields = buildQueryFields(fields); const itemService = new ItemsService(cfg.collection_name, { schema }); - const items = await itemService.readByQuery({ + const items = await itemService.readByQuery({ fields: queryFields, - filter: { + filter: { _or: [ - { status: { _null: true }}, - { status: { _neq: 'archived'}}, - ] + { status: { _neq: 'archived' } }, + { status: { _null: true } }, + ] }, - limit: -1 + limit: -1 }); // 为每种语言重建索引 @@ -238,7 +238,16 @@ export default defineHook(async ({ init, filter, action, schedule }, { services, const queryFields = buildQueryFields(fields); const itemService = new ItemsService(cfg.collection_name, { schema }); - const items = await itemService.readByQuery({ fields: queryFields, limit: -1 }); + const items = await itemService.readByQuery({ + fields: queryFields, + filter: { + _or: [ + { status: { _neq: 'archived' } }, + { status: { _null: true } }, + ] + }, + limit: -1 + }); // 为每种语言重建索引 for (const lang of availableLanguages) { @@ -310,7 +319,16 @@ export default defineHook(async ({ init, filter, action, schedule }, { services, const queryFields = buildQueryFields(fields); const itemService = new ItemsService(cfg.collection_name, { schema }); - const items = await itemService.readByQuery({ fields: queryFields, limit: -1 }); + const items = await itemService.readByQuery({ + fields: queryFields, + filter: { + _or: [ + { status: { _neq: 'archived' } }, + { status: { _null: true } }, + ] + }, + limit: -1 + }); // 为每种语言重建索引 for (const lang of availableLanguages) { @@ -386,7 +404,16 @@ export default defineHook(async ({ init, filter, action, schedule }, { services, const queryFields = buildQueryFields(fields); const itemService = new ItemsService(cfg.collection_name, { schema }); - const items = await itemService.readByQuery({ fields: queryFields, limit: -1 }); + const items = await itemService.readByQuery({ + fields: queryFields, + filter: { + _or: [ + { status: { _neq: 'archived' } }, + { status: { _null: true } }, + ] + }, + limit: -1 + }); // 为每种语言重建索引 for (const lang of availableLanguages) {