私はこの問題を解決するためにあらゆることを試みています。
検索機能付きのシンプルなアプリ レールがあります。アクセントのあるものを検索すると検索は正常に機能しますが、アクセントのない単語を検索すると結果が空になります。
Tire と Elasticsearch のドキュメントを読みましたが、何が起こっているのかわかりません
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
ベロー asciifolding を使用しようとしましたが、うまくいきませんでした。
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
Sense on Chrome を使用してテスト、マッピングを行っていますが、すべての構成に問題はありません!
何が起こっていますか???
ありがとう