Upgrade to Pro — share decks privately, control downloads, hide ads and more …

添付された日本語テキストファイルを全文検索でヒットさせる方法

 添付された日本語テキストファイルを全文検索でヒットさせる方法

HCL Domino 12.0.2 では Apache Tika のバージョンがアップグレードされました。
またこれまでは文字コードが UTF-8 のテキストファイルがサポートされていましたが、11.0.1 FP3 以降では文字コードが Shift-JIS のテキストファイルも全文検索できるよう改善されたとの技術情報があります。
そこで Shift-JIS と UTF-8 のテキストファイルを使い Domino 12.0.2 のサーバーにあるアプリケーションで全文検索を試しました。
このスライドでは、きちんと全文検索できるようにするための設定方法を記載しています。

このスライドは 2023/3/9 開催の「のの会 第49回」で使用しました。

Avatar for Haruyuki Nakano

Haruyuki Nakano

March 10, 2023
Tweet

More Decks by Haruyuki Nakano

Other Decks in Education

Transcript

  1. 添付された 日本語テキス トファイルを 全文検索で ヒットさせる 方法 Windows OS 上で Notes/Domino

    12.0.2 を使用 中野晴幸 harunakano (twitter) harunakano.blogspot.com (blog)
  2. Windowsの「メモ帳」 デフォルトの文字コード • Windows 11 は UTF-8 • Windows 10

    も May 2019 Update 以降のデフォルトは UTF-8 以前は「ANSI」 (Shift-JIS)でした
  3. Dominoのコンバージョンフィルタ • 文書にある添付ファイルのうち、対応している種類のファイル 内にあるテキストを抽出する • 10.0 で KeyView から Apache

    Tika 1.18 に変わる https://help.hcltechsw.com/domino/10.0.1/wn_apache_tika_used_for_attachment_searches.html • 12.0.2 で Apache Tika のバージョンは 2.4.1 へアップグレード https://help.hcltechsw.com/domino/12.0.2/ja/admin/wn_administration_features.html
  4. > load updall -X ftstest1202.nsf [15FC:0002-0850] Start indexing document 0x8F6

    (0 text bytes indexed) [15FC:0002-0850] Close document 0x8F6 (1361 text bytes indexed) [15FC:0002-0850] Start indexing document 0x8FA (1361 text bytes indexed) [15FC:0002-0850] Indexing Attachment Object: '吾輩は猫である。名前はまだない。Shift-JIS.txt' Size = 888 using Brute Force [15FC:0002-0850] Close document 0x8FA (2793 text bytes indexed) [15FC:0002-0850] Start indexing document 0x8FE (2793 text bytes indexed) [15FC:0002-0850] Indexing Attachment Object: '吾輩は猫である。名前はまだない。UTF-8.txt' Size = 1330 using Brute Force [15FC:0002-0850] Close document 0x8FE (2887 text bytes indexed) [15FC:0002-0850] Start indexing document 0x902 (2887 text bytes indexed) [15FC:0002-0850] Not indexing '吾輩は猫である。名前はまだない。Shift-JIS.zip' because it's extension appears in the ignore attachment types list [15FC:0002-0850] Close document 0x902 (2940 text bytes indexed) [15FC:0002-0850] Start indexing document 0x906 (2940 text bytes indexed) [15FC:0002-0850] Not indexing '吾輩は猫である。名前はまだない。UTF-8.zip' because it's extension appears in the ignore attachment types list [15FC:0002-0850] Close document 0x906 (2989 text bytes indexed) [15FC:0002-0850] Start indexing document 0x90A (2989 text bytes indexed) [15FC:0002-0850] Indexing Attachment Object: '吾輩は猫である。名前はまだない。.pdf' Size = 189222 using Tika [15FC:0002-0850] Close document 0x90A (4487 text bytes indexed) [15FC:0002-0850] 2023/03/10 08:17:14 6 documents (4631 bytes) indexed in C:¥Domino¥Data¥ftstest1202.nsf [15FC:0002-0850] 2023/03/10 08:17:14 Index update process shutdown notes.ini に デバッグパラメータを追加すると、 .txt ファイルに Tika が使われていないことがわかった( Brute Force が使われた) ※コンソールログから抜粋
  5. (デフォルトでは) .txt ファイルに Tika を使わない • .txtファイルからのテキスト抽出は Tika ではなく Domino

    側の 機能(brute force)で行われた ※追加したデバッグパラメータ DEBUG_FTV_INDEX=2 DEBUG_FTV_search=1 DEBUG_FT_STREAM=15 DEBUG_TIKA=1
  6. notes.ini に FT_USE_ATTACHMENT_WHITE_LIST=1 を追加する と、.zip 内のファイルが検索可能になる > load updall -X

    FTStest1202.nsf [15E8:0002-083C] Start indexing document 0x8F6 (0 text bytes indexed) [15E8:0002-083C] Close document 0x8F6 (1361 text bytes indexed) [15E8:0002-083C] Start indexing document 0x8FA (1361 text bytes indexed) [15E8:0002-083C] Not indexing '吾輩は猫である。名前はまだない。Shift-JIS.txt' because of ignore attachment type which the enabled whitelist doesn't override [15E8:0002-083C] Close document 0x8FA (1401 text bytes indexed) [15E8:0002-083C] Start indexing document 0x8FE (1401 text bytes indexed) [15E8:0002-083C] Not indexing '吾輩は猫である。名前はまだない。UTF-8.txt' because of ignore attachment type which the enabled whitelist doesn't override [15E8:0002-083C] Close document 0x8FE (1437 text bytes indexed) [15E8:0002-083C] Start indexing document 0x902 (1437 text bytes indexed) [15E8:0002-083C] Indexing Attachment Object: '吾輩は猫である。名前はまだない。Shift-JIS.zip' Size = 790 using Tika [15E8:0002-083C] Close document 0x902 (2958 text bytes indexed) [15E8:0002-083C] Start indexing document 0x906 (2958 text bytes indexed) [15E8:0002-083C] Indexing Attachment Object: '吾輩は猫である。名前はまだない。UTF-8.zip' Size = 857 using Tika [15E8:0002-083C] Close document 0x906 (4467 text bytes indexed) [15E8:0002-083C] Start indexing document 0x90A (4467 text bytes indexed) [15E8:0002-083C] Indexing Attachment Object: '吾輩は猫である。名前はまだない。.pdf' Size = 189222 using Tika [15E8:0002-083C] Close document 0x90A (5965 text bytes indexed) [15E8:0002-083C] 2023/03/10 07:46:11 6 documents (6109 bytes) indexed in C:¥Domino¥Data¥FTStest1202.nsf [15E8:0002-083C] 2023/03/10 07:46:11 Index update process shutdown ※コンソールログから抜粋
  7. notes.ini に FT_USE_MY_ATTACHMENT_WHITE_LIST=1 FT_INDEX_FILTER_ATTACHMENT_TYPES=*.txt,*.zip を追加すると、対象のファイルタイプを指定できる > load updall -X ftstest1202.nsf

    [0884:0002-1BB8] Start indexing document 0x8F6 (0 text bytes indexed) [0884:0002-1BB8] Close document 0x8F6 (1361 text bytes indexed) [0884:0002-1BB8] Start indexing document 0x8FA (1361 text bytes indexed) [0884:0002-1BB8] Indexing Attachment Object: '吾輩は猫である。名前はまだない。Shift-JIS.txt' Size = 888 using Brute Force [0884:0002-1BB8] Close document 0x8FA (2793 text bytes indexed) [0884:0002-1BB8] Start indexing document 0x8FE (2793 text bytes indexed) [0884:0002-1BB8] Indexing Attachment Object: '吾輩は猫である。名前はまだない。UTF-8.txt' Size = 1330 using Brute Force [0884:0002-1BB8] Close document 0x8FE (2887 text bytes indexed) [0884:0002-1BB8] Start indexing document 0x902 (2887 text bytes indexed) [0884:0002-1BB8] Indexing Attachment Object: '吾輩は猫である。名前はまだない。Shift-JIS.zip' Size = 790 using Tika [0884:0002-1BB8] Close document 0x902 (4408 text bytes indexed) [0884:0002-1BB8] Start indexing document 0x906 (4408 text bytes indexed) [0884:0002-1BB8] Indexing Attachment Object: '吾輩は猫である。名前はまだない。UTF-8.zip' Size = 857 using Tika [0884:0002-1BB8] Close document 0x906 (5917 text bytes indexed) [0884:0002-1BB8] Start indexing document 0x90A (5917 text bytes indexed) [0884:0002-1BB8] Not indexing '吾輩は猫である。名前はまだない。.pdf' because of ignore attachment type which the enabled whitelist doesn't override [0884:0002-1BB8] Close document 0x90A (5947 text bytes indexed) [0884:0002-1BB8] 2023/03/10 07:58:24 6 documents (6091 bytes) indexed in C:¥Domino¥Data¥ftstest1202.nsf [0884:0002-1BB8] 2023/03/10 07:58:24 Index update process shutdown ※コンソールログから抜粋
  8. サポートへ問合せると Domino 12.0.2 の HotFix が提供された • インストーラを実行するとNotes/Dominoを終了しているにも 関わらず「終了してから実行しろ」と叱られた •

    別の環境へはインストールできた。HotFixを有効にするため、 次の notes.ini パラメータの追加と全文索引の再構築が必要 FT_USE_MY_ATTACHMENT_BRUTE_LIST=1
  9. HotFix適用+ notes.ini パラメータ追加後 全文索引を再構築 > load updall -X FTSTest1202.nsf [0488:0002-1740]

    Start indexing document 0x8F6 (0 text bytes indexed) [0488:0002-1740] Close document 0x8F6 (1361 text bytes indexed) [0488:0002-1740] Start indexing document 0x8FA (1361 text bytes indexed) [0488:0002-1740] Indexing Attachment Object: '吾輩は猫である。名前はまだない。Shift-JIS.txt' Size = 888 using Tika [0488:0002-1740] Close document 0x8FA (2792 text bytes indexed) [0488:0002-1740] Start indexing document 0x8FE (2792 text bytes indexed) [0488:0002-1740] Indexing Attachment Object: '吾輩は猫である。名前はまだない。UTF-8.txt' Size = 1330 using Tika [0488:0002-1740] Close document 0x8FE (4215 text bytes indexed) [0488:0002-1740] Start indexing document 0x902 (4215 text bytes indexed) [0488:0002-1740] Not indexing '吾輩は猫である。名前はまだない。Shift-JIS.zip' because it's extension appears in the ignore attachment types list [0488:0002-1740] Close document 0x902 (4268 text bytes indexed) [0488:0002-1740] Start indexing document 0x906 (4268 text bytes indexed) [0488:0002-1740] Not indexing '吾輩は猫である。名前はまだない。UTF-8.zip' because it's extension appears in the ignore attachment types list [0488:0002-1740] Close document 0x906 (4317 text bytes indexed) [0488:0002-1740] Start indexing document 0x90A (4317 text bytes indexed) [0488:0002-1740] Indexing Attachment Object: '吾輩は猫である。名前はまだない。.pdf' Size = 189222 using Tika [0488:0002-1740] Close document 0x90A (5815 text bytes indexed) [0488:0002-1740] 2023/03/07 19:57:04 6 documents (5959 bytes) indexed in C:¥Domino¥Data¥FTSTest1202.nsf [0488:0002-1740] 2023/03/07 19:57:04 Index update process shutdown FT_USE_MY_ATTACHMENT_BRUTE_LIST=1 ※コンソールログから抜粋
  10. FT_USE_MY_ATTACHMENT_BRUTE_LIST=1 FT_USE_MY_ATTACHMENT_WHITE_LIST=1 FT_INDEX_FILTER_ATTACHMENT_TYPES=*.txt,*.zip,*.pdf > load updall -X FTSTest1202.nsf [0744:0002-073C] Start

    indexing document 0x8F6 (0 text bytes indexed) [0744:0002-073C] Close document 0x8F6 (1361 text bytes indexed) [0744:0002-073C] Start indexing document 0x8FA (1361 text bytes indexed) [0744:0002-073C] Indexing Attachment Object: '吾輩は猫である。名前はまだない。Shift-JIS.txt' Size = 888 using Tika [0744:0002-073C] Close document 0x8FA (2792 text bytes indexed) [0744:0002-073C] Start indexing document 0x8FE (2792 text bytes indexed) [0744:0002-073C] Indexing Attachment Object: '吾輩は猫である。名前はまだない。UTF-8.txt' Size = 1330 using Tika [0744:0002-073C] Close document 0x8FE (4215 text bytes indexed) [0744:0002-073C] Start indexing document 0x902 (4215 text bytes indexed) [0744:0002-073C] Indexing Attachment Object: '吾輩は猫である。名前はまだない。Shift-JIS.zip' Size = 790 using Tika [0744:0002-073C] Close document 0x902 (5736 text bytes indexed) [0744:0002-073C] Start indexing document 0x906 (5736 text bytes indexed) [0744:0002-073C] Indexing Attachment Object: '吾輩は猫である。名前はまだない。UTF-8.zip' Size = 857 using Tika [0744:0002-073C] Close document 0x906 (7245 text bytes indexed) [0744:0002-073C] Start indexing document 0x90A (7245 text bytes indexed) [0744:0002-073C] Indexing Attachment Object: '吾輩は猫である。名前はまだない。.pdf' Size = 189222 using Tika [0744:0002-073C] Close document 0x90A (8743 text bytes indexed) [0744:0002-073C] 2023/03/07 21:07:37 6 documents (8887 bytes) indexed in C:¥Domino¥Data¥FTSTest1202.nsf [0744:0002-073C] 2023/03/07 21:07:37 Index update process shutdown ※コンソールログから抜粋
  11. Domino 12.0.2 で .txt の全文検索結果 設定など 文字の抽出 全文検索の結果 デフォルト brute

    force Shift-JIS のみ FT_USE_ATTACHMENT_WHITE_LIST=1 索引化されない ヒットしない FT_USE_MY_ATTACHMENT_WHITE_LIST=1 FT_INDEX_FILTER_ATTACHMENT_TYPES=*.txt,*.zip brute force Shift-JIS のみ HotFix 14 適用 FT_USE_MY_ATTACHMENT_BRUTE_LIST=1 Tika ヒットする
  12. まとめ • Domino 12.0.2 (FixPack適用なし)の全文検索で UTF-8 の.txt をヒットさせるには HotFix の適用が必要です

    • ファイルの拡張子だけでなく文字コードが対応していることも 確認しましょう • 「サポートしている」とは言え、デフォルトでは検索できない 拡張子があります。Tika がサポートしているけど検索できない 拡張子のファイルがあれば、 FT_USE_MY_ATTACHMENT_WHITE_LIST=1 に加え、 FT_INDEX_FILTER_ATTACHMENT_TYPES= で全ての拡張子 を指定してみましょう