diff --git a/README.md b/README.md index 0e1ec7d..069975d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ - Natural tag insertion that considers cursor position and existing text. - **:art:Design**: Supports both light and dark themes of ComfyUI. - **:pencil:User CSV**: Allows users to add their own CSV files for autocomplete suggestions. -- **Zero Dependencies**: All input assistance processing works in the browser without external libraries. ## Installation @@ -133,6 +132,7 @@ When the browser is reloaded, you can check the list of loaded CSV files in the - **Enable Autocomplete**: Enable/disable the autocomplete feature. - **Max suggestions**: Maximum number of autocomplete suggestions to display. +- **Use Fast Search**: Switch autocomplete suggestions search to fast processing (see [About Fast Search for Autocomplete](#about-fast-search-for-autocomplete) for details). ### Related Tags @@ -172,6 +172,31 @@ You can skip the check process during ComfyUI startup by following these steps: - The check process will not be performed until the value of `check_updates_on_startup` is changed back to `true` or the `version` is switched. - Even when `check_updates_on_startup` is `false`, manual checking is still possible by pressing the `Check CSV updates` button in the Autocomplete Plus settings. +## More details on how it works + +### About Fast Search for Autocomplete + +In `v1.3.0`, Added a fast search feature functionality to autocomplete. By enabling this function in the settings screen, tag search processing during text input operates faster, improving responsiveness. +While fast operation can be expected in any scenario, I particularly recommend **enabling** it in the following use cases: + +- When the loaded CSV files contain a large number of tags or aliases. This is especially useful when the total number of tags exceeds **100,000**. +- When using natural language instead of comma-separated tags in prompt input. + +**Browser startup behavior** + +Fast search requires tag index building and is not available immediately after browser startup. The conventional search process is used until building is complete. +As of `v1.3.0`, The notification when building is completed is displayed only in the browser's developer tools. This is planned to be improved in future versions. + +For example, when index building for approximately 220,000 tags is completed, the following log is recorded: + +``` +[Autocomplete-Plus] Building 221787 index for danbooru took 9398.70ms. +``` + +> [!NOTE] +> - Index building occurs in the background even when fast search is disabled in settings +> - Fast search uses the full-text search library [nextapps-de/flexsearch](https://github.com/nextapps-de/flexsearch) + ## Known Issues ### Performance @@ -186,7 +211,9 @@ You can skip the check process during ComfyUI startup by following these steps: ## Credits -- [ComfyUI-Custom-Node](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) +- [pythongosssss/ComfyUI-Custom-Node](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) - Referenced for implementing the autocomplete function. - [DominikDoom/a1111-sd-webui-tagcomplete](https://github.com/DominikDoom/a1111-sd-webui-tagcomplete) - - Referenced for autocomplete function and CSV specifications. \ No newline at end of file + - Referenced for autocomplete function and CSV specifications. +- [nextapps-de/flexsearch](https://github.com/nextapps-de/flexsearch) + - Used to implement fast tag search processing for autocomplete. \ No newline at end of file diff --git a/docs/README_jp.md b/docs/README_jp.md index 84b9995..644bbe3 100644 --- a/docs/README_jp.md +++ b/docs/README_jp.md @@ -17,7 +17,6 @@ - カーソル位置や既存のテキストを考慮した自然なタグ挿入 - **:art:デザイン**: ComfyUIのライトテーマとダークテーマの両方に対応 - **:pencil:ユーザーCSV**: ユーザーが用意した CSV をオートコンプリート候補に追加可能 -- **依存ライブラリゼロ**: 外部ライブラリを使用せず、すべての入力支援処理がブラウザで動作 ## インストール @@ -130,7 +129,8 @@ worst_quality,5,9999999, ### オートコンプリート - **Enable Autocomplete**: オートコンプリート機能の有効化/無効化 -- **Max suggestions**: オートコンプリート候補の最大表示件数 +- **Max Suggestions**: オートコンプリート候補の最大表示件数 +- **Use Fast Search**: オートコンプリート候補の検索を高速な処理に切り替える(詳細は [オートコンプリートの高速検索について](#オートコンプリートの高速検索について) を確認してください) ### 関連タグ @@ -170,6 +170,30 @@ worst_quality,5,9999999, - `check_updates_on_startup` の値を再び `true` にするか、 `version` が切り替わるまでチェック処理は行われなくなります - `check_updates_on_startup` が `false` でも、Autocompelte Plusの設定から `Check CSV updates` のボタンを押す事で手動チェックが可能です +## 動作に関する詳細 + +## オートコンプリートの高速検索について + +`v1.3.0` にて、オートコンプリートにタグの検索を高速化する機能を追加しました。設定画面から有効にする事でテキスト入力時のタグ検索処理が高速に動作し、応答性が改善されます。 +どのような場面でも高速な動作が期待できますが、特に以下のユースケースで **有効** にすることをお勧めします。 + +- 読み込む CSV ファイルに大量のタグやエイリアスが含まれている場合。タグの合計が **10万件** を超える場合は特に有用です +- プロンプト入力でタグのカンマ区切りの代わりに自然言語を使う場合 + +**ブラウザ起動時の動作** + +高速検索はタグのインデックス構築が必要なため、ブラウザ起動直後は利用できません。構築が完了するまでは従来の検索処理で動作します。 +`v1.3.0` 時点では構築が完了したタイミングはブラウザーの開発ツールにのみが表示されます。これは将来のバージョンで改善予定です。 + +例として、約22万件のタグのインデックス構築が完了した際は以下のようなログが記録されます。 +``` +[Autocomplete-Plus] Building 221787 index for danbooru took 9398.70ms. +``` + +> [!NOTE] +> - インデックス構築は設定から高速検索を無効にしてもバックグラウンドで行われます +> - 高速検索の実現に全文検索ライブラリの (nextapps-de/flexsearch)[https://github.com/nextapps-de/flexsearch] を使用しています + ## 既知の問題 ### パフォーマンス @@ -184,7 +208,9 @@ worst_quality,5,9999999, ## クレジット -- [ComfyUI-Custom-Node](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) +- [pythongosssss/ComfyUI-Custom-Node](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) - オートコンプリート機能の実装にあたり参考にしました - [DominikDoom/a1111-sd-webui-tagcomplete](https://github.com/DominikDoom/a1111-sd-webui-tagcomplete) - オートコンプリートの主要な機能や CSV の仕様で参考にしました +- [nextapps-de/flexsearch](https://github.com/nextapps-de/flexsearch) + - オートコンプリートの高速なタグ検索処理の実装に利用させてもらいました \ No newline at end of file