FOSElasticaBundle を使用して、この構成で ES ドキュメントのインデックスを作成しています。
index:
analysis:
analyzer:
custom_analyzer:
type: custom
tokenizer: nGram
filter: [stopwords, asciifolding ,lowercase, snowball, elision, worddelimiter]
custom_search_analyzer:
type: custom
tokenizer: standard
filter: [stopwords, asciifolding ,lowercase, snowball, elision, worddelimiter]
tokenizer:
nGram:
type: nGram
min_gram: 2
max_gram: 20
filter:
snowball:
type: snowball
language: French
elision:
type: elision
articles: [l, m, t, qu, n, s, j, d]
stopwords:
type: stop
stopwords: [_french_]
ignore_case: true
worddelimiter:
type: word_delimiter
types:
document:
indexable_callback: 'isIndexable'
mappings:
title:
boost: 3
index_analyzer: custom_analyzer
search_analyzer: custom_search_analyzer
summary:
boost: 2
index_analyzer: custom_analyzer
search_analyzer: custom_search_analyzer
description:
boost: 1
index_analyzer: custom_analyzer
search_analyzer: custom_search_analyzer
ES のハイライト機能を使用しようとしています。リクエストの例を次に示します。
{
"query":
{
"bool":
{
"must":
[
{
"query_string": {
"query": "blonde",
"default_field": "_all"
}
}
]
}
},
"highlight": {
"fields": {
"*": { }
}
}
}
結果は次のとおりです。
"highlight": {
"title": [
"Une jeune personne b<em>personne blonde se</em><em>ersonne blonde se te</em><em>blonde se tenait e</em>n partie double, elle avait choisi."
]
}
元の内容はUne jeune personne blonde se tenait en partie double, elle avait choisi.
さまざまなアナライザー構成とドキュメントの再インデックス化を使用していくつかのテストを行いましたが、すべてのスニペットの適切な強調表示が得られませんでした: 1 つが強調表示され、他のスニペットが強調表示されない場合もあれば、何も強調表示されない場合もあります。
アナライザーとハイライト プロセスの間の問題は何ですか? 構成の何が問題になっていますか?