0
假設我想在BlogPosts之類的東西上創建兩個單獨的索引,以便我可以使用一個索引(例如爲了自動完成目的)快速搜索,然後使用其他索引進行全面的搜索查詢。每個ActiveModel/Record有多個映射?
我可以用Tire做點什麼嗎? 所以這樣的事情(如果有點原始見諒)
class Post < ActiveRecord::Base
include Tire::Model::Search
include Tire::Model::Callbacks
index_name 'autocomplete'
mapping do
indexes :title, :analyzer => 'my_ngram_analyzer'
end
index_name 'main'
mapping do
indexes :title
indexes :description
indexes :author
indexes :published_on
end
end
在回調知道從相應的索引中添加和刪除新帖
交叉後謝謝果報工作者,我留了一張紙條用於輪胎的問題頁面上爲好。 – concept47