Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Opensearch #90

Merged
merged 2 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .config/docker_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ redis:
# index: ''
# scope: local

# ┌───────────────────────────┐
#───┘ OpenSearch configuration └─────────────────────────────

# You can use OpenSearch when you enabled AdvancedSearch.

#opensearch:
# host: opensearch
# port: 9200
# user: 'admin'
# pass: 'opensearch-adminpassword' #強めのパスワードじゃないと怒られる
# ssl: false
# index: 'instancename' #なんでもいい

# ┌───────────────┐
#───┘ ID generation └───────────────────────────────────────────

Expand Down
10 changes: 4 additions & 6 deletions .config/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,17 @@ redis:


# ┌───────────────────────────┐
#───┘ OpenSearch configuration └─────────────────────────────
#───┘ OpenSearch configuration └─────────────────────────────

# You can use OpenSearch when you enabled AdvancedSearch.
# THIS DOES NOT WORK BECAUSE OF WIP

#opensearch:
# host: localhost
# port: 9200
# user: ''
# pass: ''
# user: 'admin'
# pass: 'opensearch-adminpassword' #強めのパスワードじゃないと怒られる
# ssl: false
# index: ''
# dictName: ''
# index: 'instancename' #なんでもいい

# ┌───────────────┐
#───┘ ID generation └───────────────────────────────────────────
Expand Down
40 changes: 39 additions & 1 deletion CHANGELOG_yojo.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,45 @@
### Misc

-->
## 0.2.0 (unreleased)
## 0.3.0 (unreleased)

### Release Date

### General
-

### Client
-

### Server
- Feat: OpenSearchを利用できるように
- Enhance: 高度な検索に新たな条件を追加(OpenSearchが必要です)
- 添付ファイルのセンシティブ条件(なし/含む/除外)
- 引用ノート除外
- 検索方法の詳細はdoc/Advanced-Search.mdに
- Change:APIのパラメータを変更
- notes/advanced-search の"excludeNsfw"を"excludeCW"に変更
- notes/advanced-search の"channelId"を削除

## 0.2.2
Cherrypick 4.9.0-beta.2

### General

### Client

### Server
- remove: チャンネル機能のAPIを削除

## 0.2.1
Cherrypick 4.9.0-beta.2

### Client
- feat: マスコット画像を表示するウィジェットを追加

## 0.2.0
Cherrypick 4.9.0-beta.2

### General
- enhance: ノートとユーザーの検索時に照会を行うかが選択できるようになりました
- @foo@example.com 形式でユーザ検索した場合に照会ができるようになりました
Expand Down
51 changes: 51 additions & 0 deletions doc/Advanced-Search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

### 高度な検索の使い方

<details open><summary> OR検索</summary>

猫かにゃんを含むノートを検索
```
猫|にゃん
```
|(パイプ)をキーワードの間に入れます
</details>

<details open><summary>AND検索</summary>

猫とにゃんを含むノートを検索
```
猫 にゃん
```
全角または半角のスペースをキーワードの間に入れます
</details>

<details open><summary> NOT検索</summary>


猫を含みにゃんを含まないノートを検索
```
猫 -にゃん
```
半角スペースで区切ってから-(マイナス/ハイフン)キーワードの間に入れます
</details>

<details open><summary>一致検索</summary>
表記ゆれやあいまい検索がデフォルトで有効になっているので確実に指定したい場合

にゃんで検索するとにゃーんや、にゃーーんも検索で出てきます

にゃんのみを含むノートを検索
```
"にゃん"
```
"(ダブルコーテーション)でキーワードを囲います
</details>


<details open><summary>組み合わせ検索</summary>

にゃんを含み、猫または狐を含み、こやんを含まないノートを検索
```
"にゃん" (猫|狐) -こやん
```
</details>
35 changes: 35 additions & 0 deletions docker-compose.local-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,38 @@ services:
# volumes:
# - ./meili_data:/meili_data

# opensearchとopensearch-dashboardsのdockerfileは実装時の最新版の辞書なので適宜書き換えてください
# opensearch:
# build: ./opensearch
# environment:
# - "server.ssl.enabled:false"
# - "discovery.type=single-node"
# - "OPENSEARCH_INITIAL_ADMIN_PASSWORD=opensearch-adminpassword" #強めのパスワードじゃないと怒られる
# - "plugins.security.disabled=true"
# ulimits:
# memlock:
# soft: -1 # Set memlock to unlimited (no soft or hard limit)
# hard: -1
# nofile:
# soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
# hard: 65536
# volumes:
# - ./os-data:/usr/share/opensearch/data
# networks:
# - internal_network
# - external_network

#OpenSearchのダッシュボードを見る場合に必要
# opensearch-dashboards:
# build: ./opensearch-dashboards
# ports:
# - 5601:5601
# links:
# - opensearch
# expose:
# - '5601'
# environment:
# OPENSEARCH_HOSTS: 'http://opensearch:9200'
# networks:
# - internal_network
# - external_network
36 changes: 36 additions & 0 deletions docker-compose_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,42 @@ services:
# interval: 5s
# retries: 20

# opensearchとopensearch-dashboardsのdockerfileは実装時の最新版の辞書なので適宜書き換えてください
# opensearch:
# build: ./opensearch
# environment:
# - "server.ssl.enabled:false"
# - "discovery.type=single-node"
# - "OPENSEARCH_INITIAL_ADMIN_PASSWORD=opensearch-adminpassword" #強めのパスワードじゃないと怒られる
# - "plugins.security.disabled=true"
# ulimits:
# memlock:
# soft: -1 # Set memlock to unlimited (no soft or hard limit)
# hard: -1
# nofile:
# soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
# hard: 65536
# volumes:
# - ./os-data:/usr/share/opensearch/data
# networks:
# - internal_network
# - external_network

#OpenSearchのダッシュボードを見る場合に必要
# opensearch-dashboards:
# build: ./opensearch-dashboards
# ports:
# - 5601:5601
# links:
# - opensearch
# expose:
# - '5601'
# environment:
# OPENSEARCH_HOSTS: 'http://opensearch:9200'
# networks:
# - internal_network
# - external_network

# meilisearch:
# restart: always
# image: getmeili/meilisearch:v1.3.4
Expand Down
28 changes: 27 additions & 1 deletion locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11543,7 +11543,7 @@ export interface Locale extends ILocale {
/**
* CW付きを除外する
*/
"toggleNsfw": string;
"toggleCW": string;
/**
* リプライを除外する
*/
Expand All @@ -11556,6 +11556,10 @@ export interface Locale extends ILocale {
* 高度な検索を有効にする
*/
"toggleAdvancedSearch": string;
/**
* 引用を除外する
*/
"toggleQuote": string;
};
"_specifyDate": {
/**
Expand All @@ -11573,6 +11577,28 @@ export interface Locale extends ILocale {
*/
"other": string;
};
"_fileNsfwOption": {
/**
* 添付ファイルのセンシティブ状態
*/
"title": string;
/**
* フィルタしない
*/
"combined": string;
/**
* 除外
*/
"withOutSensitive": string;
/**
* 含むもの
*/
"includeSensitive": string;
/**
* 全てセンシティブ
*/
"sensitiveOnly": string;
};
};
"_searchOrApShow": {
/**
Expand Down
9 changes: 8 additions & 1 deletion locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3078,15 +3078,22 @@ _advancedSearch:
noFile: "なし"
combined: "全て"
_searchOption:
toggleNsfw: "CW付きを除外する"
toggleCW: "CW付きを除外する"
toggleReply: "リプライを除外する"
toggleDate: "日時を指定する"
toggleAdvancedSearch: "高度な検索を有効にする"
toggleQuote: "引用を除外する"
_specifyDate:
startDate: "から"
endDate: "まで"
_description:
other: "その他の設定"
_fileNsfwOption:
title: "添付ファイルのセンシティブ状態"
combined: "フィルタしない"
withOutSensitive: "除外"
includeSensitive: "含むもの"
sensitiveOnly: "全てセンシティブ"

_searchOrApShow:
question: "照会を行いますか?"
Expand Down
3 changes: 3 additions & 0 deletions opensearch-dashboards/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM opensearchproject/opensearch-dashboards:2.14.0
RUN /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin remove securityDashboards
COPY --chown=opensearch-dashboards:opensearch-dashboards opensearch_dashboards.yml /usr/share/opensearch-dashboards/config/
3 changes: 3 additions & 0 deletions opensearch-dashboards/opensearch-dashboards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
server.name: opensearch-dashboards
server.host: "0.0.0.0"
opensearch.hosts: http://localhost:9200
Dismissed Show dismissed Hide dismissed
14 changes: 14 additions & 0 deletions opensearch/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:latest
RUN apk update && apk add curl unzip
WORKDIR /sudachi-dictionary

RUN curl -sSL -o sudachi-dictionary-core.zip https://github.com/WorksApplications/SudachiDict/releases/download/v20240409/sudachi-dictionary-20240409-core.zip
RUN unzip sudachi-dictionary-core.zip

RUN curl -sSL -o sudachi-dictionary.zip https://github.com/WorksApplications/SudachiDict/releases/download/v20240409/sudachi-dictionary-20240409-full.zip
RUN unzip -o sudachi-dictionary.zip

FROM opensearchproject/opensearch:2.14.0
RUN /usr/share/opensearch/bin/opensearch-plugin install --batch \
https://github.com/WorksApplications/elasticsearch-sudachi/releases/download/v3.2.2/opensearch-2.14.0-analysis-sudachi-3.2.2.zip
COPY --from=0 /sudachi-dictionary/sudachi-dictionary-20240409 config/sudachi/
Loading
Loading