Skip to content

Commit 2b0511e

Browse files
committed
Combine content comments in advanced search
Closes #1096
1 parent 54e746f commit 2b0511e

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

Tekst-API/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9991,7 +9991,7 @@
99919991
"maxLength": 512,
99929992
"minLength": 0,
99939993
"title": "Cmt",
9994-
"description": "Comment search query",
9994+
"description": "Author's/editor's comment search query",
99959995
"default": "",
99969996
"optionalNullable": true
99979997
}

Tekst-API/tekst/resources/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class CommonResourceSearchQueryData(ModelBase):
115115
),
116116
Field(
117117
alias="cmt",
118-
description="Comment search query",
118+
description="Author's/editor's comment search query",
119119
),
120120
SchemaOptionalNullable,
121121
] = ""
@@ -198,7 +198,10 @@ def index_doc(
198198
"""
199199
return dict(
200200
native=native,
201-
comment=content.authors_comment,
201+
comment=" ".join(
202+
[content.authors_comment or "", content.editors_comment or ""]
203+
).strip()
204+
or None,
202205
**(cls._rtype_index_doc(content) or {}),
203206
)
204207

Tekst-Web/src/api/schema.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,7 @@ export interface components {
24422442
res: string;
24432443
/**
24442444
* Cmt
2445-
* @description Comment search query
2445+
* @description Author's/editor's comment search query
24462446
* @default
24472447
*/
24482448
cmt?: string;

Tekst-Web/src/forms/formRules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ export const contentFormRules: Record<string, Record<string, FormItemRule[]>> =
467467

468468
export const searchFormRules: Record<string, Record<string, FormItemRule[]>> = {
469469
common: {
470-
authorsComment: [minMaxCharsRule(0, 512, 'blur')],
470+
comment: [minMaxCharsRule(0, 512, 'blur')],
471471
},
472472
plainText: {
473473
text: [minMaxCharsRule(0, 512, 'blur')],

Tekst-Web/src/forms/resources/search/CommonSearchFormItems.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ defineProps<{
99
queryIndex: number;
1010
}>();
1111
12-
const authorsComment =
12+
const comment =
1313
defineModel<NonNullable<AdvancedSearchRequestBody['q']>[number]['cmn']['cmt']>('comment');
1414
</script>
1515

1616
<template>
1717
<n-form-item
18-
:label="$t('resources.types.common.contentFields.authorsComment')"
18+
ignore-path-change
19+
:label="$t('common.comment', 2)"
1920
:path="`queries[${queryIndex}].cmn.cmt`"
20-
:rule="searchFormRules.common.authorsComment"
21+
:rule="searchFormRules.common.comment"
2122
>
22-
<osk-input v-model="authorsComment" :placeholder="$t('common.comment')" />
23+
<osk-input v-model="comment" :placeholder="$t('common.comment')" />
2324
</n-form-item>
2425
</template>

0 commit comments

Comments
 (0)