Skip to content

Commit

Permalink
Enhance: 高度な検索でもクエリ文字列を使えるように (kokonect-link#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
penginn-net authored Oct 18, 2024
1 parent d070349 commit 7fc7d17
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 15 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG_YOJO.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ Cherrypick 4.11.1
- Fix: リアクションが閲覧できる状態でも見れない問題を修正 [#429](https://github.com/yojo-art/cherrypick/pull/429)
- Enhance: チャートの連合グラフで割合を表示
- Enhance: お気に入り登録クリップの一覧画面から登録解除できるように
- Enhance: 高度な検索でもクエリ文字列を使えるように
- `/search?type=anote`
- `q` 通常検索と同じ
- `userId` 通常検索と同じ
- `username` 通常検索と同じ
- `host` 通常検索と同じ
- `fileAttach`添付ファイル有無 あり:`file-only`なし:`no-file`
- `fileSensitive`添付ファイルセンシティブ状態 あり:`includeSensitive` なし:`withOutSensitive` センシティブのみ`sensitiveOnly`
- `reactions` リアクション検索ボックス
- `reactionsExclude` リアクション検索ボックス(除外)
- `excludeReply` リプライ除外 true/false
- `excludeCw` CW除外 true/false
- `excludeQuote` 引用除外 true/false
- `strictSearch` 表記ゆれ検索有効 true/false
- Fix: リモートから添付されてきたクリップURLにホスト情報があると二重になる不具合を修正 [#460](https://github.com/yojo-art/cherrypick/pull/460)
- Fix: リモートクリップ説明文がローカル仕様になってる問題の修正 [#466](https://github.com/yojo-art/cherrypick/pull/466)
- Fix: ユーザー概要の「ファイル」の挙動を通常の添付ファイルに合わせる [#472](https://github.com/yojo-art/cherrypick/pull/472)
Expand Down
58 changes: 44 additions & 14 deletions packages/frontend/src/pages/search.anote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import { ref, toRef } from 'vue';
import type { UserDetailed } from 'cherrypick-js/entities.js';
import MkNotes from '@/components/MkNotes.vue';
import MkRadios from '@/components/MkRadios.vue';
Expand All @@ -121,25 +121,55 @@ import FormSection from '@/components/form/section.vue';
import { $i } from '@/account.js';
import { instance } from '@/instance.js';
import { emojiPicker } from '@/scripts/emoji-picker';
import { Paging } from '@/components/MkPagination.vue';

const props = withDefaults(defineProps<{
query?: string;
userId?: string;
username?: string;
host?: string | null;
fileAttach?: string;
fileSensitive?: string;
reactions?: string;
reactionsExclude?: string;
following?: string;
excludeReply?: boolean;
excludeCw?: boolean;
excludeQuote?: boolean;
strictSearch?: boolean;
}>(), {
query: '',
userId: undefined,
username: undefined,
host: '',
fileAttach: 'combined',
fileSensitive: 'combined',
reactions: '',
reactionsExclude: '',
following: 'combined',
excludeReply: false,
excludeCw: false,
excludeQuote: false,
strictSearch: false,
});
const router = useRouter();

const key = ref(0);
const searchQuery = ref('');
const searchQuery = ref(toRef(props, 'query').value);
const notePagination = ref<Paging>();
const user = ref<UserDetailed | null>(null);
const hostInput = ref(toRef(props, 'host').value);
const searchOrigin = ref('combined');
const notePagination = ref();
const user = ref<any>(null);
const isLocalOnly = ref(false);
const isfileOnly = ref('combined');
const excludeCW = ref(false);
const excludeReply = ref(false);
const excludeQuote = ref(false);
const sensitiveFilter = ref('combined');
const followingFilter = ref('combined');
const hostInput = ref('');
const emojiSearchQuery = ref('');
const emojiExcludeSearchQuery = ref('');
const strictSearch = ref(false);
const isfileOnly = ref(toRef(props, 'fileAttach').value);
const sensitiveFilter = ref(toRef(props, 'fileSensitive').value);
const emojiSearchQuery = ref(toRef(props, 'reactions').value);
const emojiExcludeSearchQuery = ref(toRef(props, 'reactionsExclude').value);
const followingFilter = ref(toRef(props, 'following').value);
const excludeReply = ref(toRef(props, 'excludeReply').value);
const excludeCW = ref(toRef(props, 'excludeCw').value);
const excludeQuote = ref(toRef(props, 'excludeQuote').value);
const strictSearch = ref(toRef(props, 'strictSearch').value);
const noteSearchableScope = instance.noteSearchableScope ?? 'local';

function selectUser() {
Expand Down
20 changes: 19 additions & 1 deletion packages/frontend/src/pages/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only

<MkSpacer v-if="tab === 'anote'" key="anote" :contentMax="800">
<div v-if="advanccedNotesSearchAvailable">
<XAnote/>
<XAnote v-bind="props"/>
</div>
<div v-else>
<MkInfo warn>{{ i18n.ts.notesAdvancedSearchNotAvailable }}</MkInfo>
Expand Down Expand Up @@ -50,6 +50,15 @@ const props = withDefaults(defineProps<{
userId?: string,
username?: string,
host?: string | null,
fileAttach?: string;
fileSensitive?: string;
reactions?: string;
reactionsExclude?: string;
following?: string;
excludeReply?: boolean;
excludeCw?: boolean;
excludeQuote?: boolean;
strictSearch?: boolean;
type?: 'note' | 'user' | 'anote' | 'event',
origin?: 'combined' | 'local' | 'remote',
// For storybook only
Expand All @@ -59,6 +68,15 @@ const props = withDefaults(defineProps<{
userId: undefined,
username: undefined,
host: undefined,
fileAttach: 'combined',
fileSensitive: 'combined',
reactions: '',
reactionsExclude: '',
following: 'combined',
excludeReply: false,
excludeCw: false,
excludeQuote: false,
strictSearch: false,
type: 'note',
origin: 'combined',
ignoreNotesSearchAvailable: false,
Expand Down
9 changes: 9 additions & 0 deletions packages/frontend/src/router/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ const routes: RouteDef[] = [{
userId: 'userId',
username: 'username',
host: 'host',
fileAttach: 'fileAttach',
fileSensitive: 'fileSensitive',
reactions: 'reactions',
reactionsExclude: 'reactionsExclude',
following: 'following',
excludeReply: 'excludeReply',
excludeCw: 'excludeCw',
excludeQuote: 'excludeQuote',
strictSearch: 'strictSearch',
channel: 'channel',
type: 'type',
origin: 'origin',
Expand Down

0 comments on commit 7fc7d17

Please sign in to comment.