legacy-knowledge-base
公開されました Jul. 2, 2025

検索時の非関連語一致

written-by

Ricardo Couso

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • まれに、検索時に検索語とは関係のないタイトルでマッチングされた予期せぬ結果が出ることがあります。
  • 例としては、以下のような感じです:
    • 検索ワード: レース.
    • 結果: レースレースだけでなく、 裂傷もある。

Environment

  • Liferay DXP 7.3, 7.4

解決策

  • まとめると、この動作が発生するのは
    1. laces は、 laceとして分析されています、
    2. lacerations は、 lacerとして解析されています、
    3. lace は、 lacerのプレフィックスです、
    4. 有効な検索は、 lace*
  • より詳細には、Elasticsearchはテキストをインデックス化し検索する際、言語に応じて分析し、 lacer から lacerationsのように一連のトークンを生成する。
    • ${elasticsearch-domain-and-port}/${liferay-index}/_analyze?source={%22analyzer%22:%22liferay_analyzer_en%22,%22text%22:%22laces,lacerations%22}&source_content_type=application/json&pretty
  • lace* による効果的な検索は、タイトルに使用される検索タイプ match_phrase_prefixの結果である。 Elasticsearch 6からElasticsearch 7コネクタへのアップグレード後の検索時の動作の変化 をご参照ください。
  • この行動は変えられるのでしょうか?
    • コンフィギュレーション経由ではありません。
    • 未対応 オプションは、上記リンク先の同記事で言及されています。
      • 要するに、 @Component プロパティ title.fields in class FieldQueryBuilderFactoryImpl.javaname|title から nameだけへ変更する、ということでしょう。
      • そのために、 .config ファイルを作成し、名前 com.liferay.portal.search.internal.analysis.FieldQueryBuilderFactoryImpl.config 、内容 title.fields="name"、そして $LIFERAY_HOME/osgi/configs/に配置する.
      • 注: この方法はサポートされていないため、検討する場合は十分に評価・テストする必要があります。

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base