我有一个Rails应用程序,其中我使用Thinking-Sphinx
进行搜索,ActsAsTaggableOn
进行标记。我希望能够在我的搜索查询中包含当前选定的标签。我尝试了以下,但没有得到它的工作。使用ActsAsTaggableOn思考狮身人面像标签搜索
在我的控制器:
def show
@team_tags = @team.ideas.tag_counts_on(:tags)
if params[:tag]
@ideas = @team.ideas.search(params[:search], :conditions => { tags: "tag" })
else
@ideas = @team.ideas.search(params[:search])
end
end
我为我的Idea
模型索引:
ThinkingSphinx::Index.define :idea, :with => :real_time do
[...]
indexes tags.name, :as => :tags
has user_id, type: :integer
has team_id, type: :integer
[...]
end
这给了我下面的错误他:
ActionView::Template::Error (index idea_core: query error: no field 'tags' found in schema
当我有一个标签选择我URLs
是这样的:
/teams/1/tags/tag
那么,我应该怎么做才能让Thinking-Sphinx
和ActsAsTaggableOn
一起工作?
您使用过rake ts:start和rake ts:index http://pat.github.io/thinking-sphinx/quickstart.html –
@ThanatosSama是的,我已经完成了。 – Anders