검색을 위해 탄력적 인 검색과 타이어를 설정했습니다.타이어 검색에서 악센트를 무시하지 않습니다
내 모델에서 다음 설정이 있습니다
tire.settings :analysis => {
:analyzer => {
:spanish_snowball => {
:type => "snowball",
:language => "Spanish",
:filter => %w{asciifolding lowercase}
}
}
}
을 그리고 다음 매핑 :
tire.mapping do
indexes :id, :index => :not_analyzed
indexes :name, :analyzer => 'spanish_snowball', :boost => 3
indexes :urbanization, :analyzer => 'spanish_snowball'
indexes :categories do
indexes :name, :analyzer => 'spanish_snowball'
end
indexes :tags do
indexes :name, :analyzer => 'spanish_snowball'
end
end
가 나는 또한
def to_indexed_json
to_json include: { categories: { only: [:name]}, tags: { only: [:name]} }
end
내가 악센트를 무시하려는 to_indexed_json
방법을 정의를 내 검색 결과, 내에 asciifolding
을 사용하고 있습니다. 10 분석기. 그러나 액센트는 무시되지 않습니다. 나는 컬 분석기를 테스트 한
Business.tire.search("japonés").size
=> 10
Business.tire.search("japones").size
=> 0
은 분석기는 당신이 말할 검색 쿼리를 분석하는 방법 elasticsearch 할 필요가 검색을 수행 할 때
➜ ~ curl -XGET 'localhost:9200/businesses/_analyze?pretty=1&text=Japonés%20nobu&analyzer=spanish_snowball'
{
"tokens" : [ {
"token" : "japones",
"start_offset" : 0,
"end_offset" : 7,
"type" : "<ALPHANUM>",
"position" : 1
}, {
"token" : "nobu",
"start_offset" : 8,
"end_offset" : 12,
"type" : "<ALPHANUM>",
"position" : 2
} ]
}%