1
나는이 문제를 해결하기 위해 모든 것을 노력하고있다.탄성 검색 + 타이어가 악센트를 무시하지 않음
나는 간단한 앱 레일을 가지고 있습니다. 악센트로 검색 할 때 검색이 제대로 작동하지만 악센트가없는 단어를 검색하면 결과가 비어 있습니다.
나는 타이어와 Elasticsearch의 문서화를 읽을 수 있지만 나는 우는 소리가 나는 asciifolding를 사용하려고class Article < ActiveRecord::Base
attr_accessible :description, :title, :user_id
belongs_to :user
include Tire::Model::Search
include Tire::Model::Callbacks
mapping do
indexes :_id, index: :not_analyzed
indexes :title, analyzer: 'snowball', boost: 100
indexes :description, analyzer: 'snowball'
end
def self.search(params)
tire.search(page: params[:page], per_page: 10) do
query { string params[:q], default_operator: "AND" } if params[:q].present?
end
end
end
무슨 일이 일어나고 있는지 모르지만 그것은 일을 않았나.
class Article < ActiveRecord::Base
attr_accessible :description, :title, :user_id
include Tire::Model::Search
include Tire::Model::Callbacks
tire.settings :index => {
:analysis => {
:analyzer => {
:index_analyzer => {
:tokenizer => "whitespace",
:filter => ["asciifolding", "lowercase", "snowball"]
},
:search_analyzer => {
:tokenizer => "whitespace",
:filter => ["asciifolding", "lowercase", "snowball"]
}
},
:filter => {
:snowball => {
:type => "snowball",
:language => "Portuguese"
}
}
}
}
mapping do
indexes :_id, index: :not_analyzed
indexes :title, analyzer: 'snowball', boost: 100
indexes :description, analyzer: 'snowball'
end
def self.search(params)
tire.search(page: params[:page], per_page: 10) do
query { string params[:q], default_operator: "AND" } if params[:q].present?
end
end
end
Chrome에서 Sense를 사용하여 테스트, 매핑 및 모든 구성이 정상적으로 작동합니다.
무슨 일입니까?
감사합니다.