Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Drupal Elasticsearch Connector の日本語検索の質を高める
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Koji Kawamura
October 06, 2021
Technology
290
0
Share
Drupal Elasticsearch Connector の日本語検索の質を高める
2021-10-06 に Acquia でぶちゃんねるで発表した資料です。
Koji Kawamura
October 06, 2021
More Decks by Koji Kawamura
See All by Koji Kawamura
ESRE とか ELSER とか RRF ってナニ!? もろもろ理解してスッキリしよう
ijokarumawak
2
2.5k
Other Decks in Technology
See All in Technology
既存プロダクトQAから新規プロダクトQAへ
ryotakahashi
0
200
Loadbalancing exporter internals
ymotongpoo
1
130
GitHub Copilot のこれまでとこれから: From Copilot to Collaborative Agents
yuriemori
1
160
Claude Code x Accounting
kawaguti
PRO
1
310
long-running-tasks
cipepser
2
280
GitHub Copilot CLI の Rubber Duck 機能を使ってコーディングの品質をあげよう #techbaton_findy
stefafafan
2
1k
『家族アルバム みてね』における インシデント対応との向き合い方 / Approach incident response in Family Album
kohbis
2
160
開発にAIを組織として取り入れる一歩目とその後
yujishibuya
0
210
AI とサービス・デザイン / AI and Service Design
ks91
PRO
0
160
AIAgentと取り組むKaggle
508shuto
2
540
A Harness for Behaviour: how to get AI to generate code that does what we intend, or "TDD in the age of AI"
xpmatteo
0
400
DI コンテナ自動生成ツールを実装してみた / intro-autodi
uhzz
0
860
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
300
Code Review Best Practice
trishagee
74
20k
How to Talk to Developers About Accessibility
jct
2
200
Game over? The fight for quality and originality in the time of robots
wayneb77
1
170
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.2k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Music & Morning Musume
bryan
47
7.2k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
HDC tutorial
michielstock
2
670
Prompt Engineering for Job Search
mfonobong
0
310
The agentic SEO stack - context over prompts
schlessera
0
780
Transcript
Drupal Elasticsearch Connector の 日本語検索の質を高める Koji Kawamura, Education Architect Oct
6, 2021
適切に権限を絞ったユーザを利用する "elastic" はスーパーユーザ! Elasticsearch drupal_* その他 drupal-connector
Elasticsearch に ロールを作成 クラスタ稼働状況の monitor 権限と 特定インデックスの操作の み許可
Elasticsearch に ユーザを作成 先程作成したロールを付与 したユーザを作成 パスワードに # があると Drupal から接続時にエ
ラーになるので注意 (内部で parse_url 関数を 利用しているため)
Drupal から Elasticsearch へ セキュアに接続 Elasticsearch 側のセキュ リティ設定をするのは大前 提。 Connector
の設定画面で 設定したパスワードはその まま閲覧できてしまう 最低限の権限でアクセス
インデックス名 インデックス名のプリフィッ クスをつけておくと他のイン デックスと差別化しやすい
Elasticsearch で全文検索 転置インデックスを作っている Elasticsearch drupal_* drupal-connector pages https://www.book-editing.com/why-book-indexing/ 本の末尾にある索引のような、転置インデックス
POST _analyze { "analyzer": "standard", "text": ["可愛いしいたけを試してみてください。"] } 検索漏れは少ないが、ノイズが大量発生。 「たけのこ」でもヒットするでしょう。
デフォルトの日本語解析
POST _analyze { "analyzer": "kuromoji", "text": ["可愛いしいたけを試してみてください。"] } 「しいたけ」で検索した場合のみヒットできる。 ノイズが減る。
Kuromoji は Elasticsearch のプラグイン。 形態素解析 kuromoji
Elasticsearch インデックスのカスタマイズ Drupal 側で作成する前に、事前に作成しておく Elasticsearch drupal_* drupal-connector pages Drupal 側から連携する前
に明示的に作成 1 2
インデックスを事前作成 PUT drupal_allcontents { "mappings": { "properties": { "_language": {
"type": "keyword" }, "body": { "type": "text", "analyzer": "kuromoji" } }, "id": { "type": "keyword" } } } 事前に作成しておけば、 Drupal の設定画面から指 定できない設定も行える
kuromoji でノイズを 減らすことができた! 可愛いしいたけを試してみてください。 でも、 ヒットしない
kuromoji_readingform で 読み仮名検索 可愛いしいたけを試してみてください。 doc #1 語 ドキュメント ID シイタケ
1 本文も検索語もカタカナで 解析してあげる
記事の本文を複数の方法でインデックス body を body と body_kana の二つの方法で索引付け
ユーザ辞書 kuromoji では辞書を使っ て単語の分割をしている 辞書に載っていない単語、 新語は検索もれが発生し てしまう そこでユーザ辞書! kuromoji_ dictionari
es.zip vi dictionaries/userdict_ja.txt 平茸,平茸,ヒラタケ,カスタム名詞 zip -r kuromoji_dictionaries.zip dictionaries
同義語 (シノニム) 同じものだけど 別の呼び方 ミルク、牛乳
おまけ Connector が発行するクエリってどんなの? Slow query でログ出力して観察
Elastic App Search という選択肢も クエリログの分析 ユーザが検索したキーワードで検索結果がヒッ トしない、もしくはクリックされない場合、検索エ ンジンとして改善が必要 関連度チューニング 複数の検索語を入力する際、全て含む
AND いずれか OR 3つ以上の場合少なくとも 1つ、 曖昧検索する?などを一つのスライダで制御可 能 クローラ Web サイトの自動巡回クローラがついに GA! より簡単にサイト内検索を提供可能に https://www.elastic.co/jp/app-search/
Elastic 公式トレーニングの紹介 体系的に学びたい方は是非 どんなコース?受講方法は? Elastic 公式トレーニングサービスのご紹介 https://www.elastic.co/jp/webinars/intro-to-elastic-training 定期開催 Elastic 公式トレーニングスケジュール
https://www.elastic.co/jp/training/schedule?timezone=Asia+-+Tokyo
Q&A Thank you!