使用 sphinx 搜索结果

发布于 2024-12-01 07:10:24 字数 1023 浏览 2 评论 0原文

我正在使用 sphinx beta 和 Thinking-sphinx 来执行搜索功能..搜索我

wann should search for the word i entered in the database.which is populated with data already.
so in my application Mydoc,i got articlesmodel and controller.. articles is db is populated with data.

i wann to search for the data in articles..so far i ve done with following things but not getting the search result

=> created new search controller
  def index
   @articles = Article.search params[:search]
   end


 => articles.rb(model)
    define_index do

  indexes name, :sortable => true
    indexes description
    indexes title, :sortable => true
    end
 def self.search(search)
  ThinkingSphinx::Search
 end
 => searches/index.html.erb
<%= form_tag  do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "search", :name => nil %>
</p>
<% end %>
  BUT WEN I CLICK ON THE SEARCH BUTTON ITS ASKING FOR CREATEACTION ?????
PLEASE COULD U HELP TO GET SEARCH RESULT

i am using sphinx beta and thinking-sphinx to perform search functionality..the search i

wann should search for the word i entered in the database.which is populated with data already.
so in my application Mydoc,i got articlesmodel and controller.. articles is db is populated with data.

i wann to search for the data in articles..so far i ve done with following things but not getting the search result

=> created new search controller
  def index
   @articles = Article.search params[:search]
   end


 => articles.rb(model)
    define_index do

  indexes name, :sortable => true
    indexes description
    indexes title, :sortable => true
    end
 def self.search(search)
  ThinkingSphinx::Search
 end
 => searches/index.html.erb
<%= form_tag  do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "search", :name => nil %>
</p>
<% end %>
  BUT WEN I CLICK ON THE SEARCH BUTTON ITS ASKING FOR CREATEACTION ?????
PLEASE COULD U HELP TO GET SEARCH RESULT

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笨笨の傻瓜 2024-12-08 07:10:24

您的表单正在向 SearchController 发出 POST 请求,这被解释为对创建操作的调用。尝试在表单中使用 GET 请求 - 如下所示:

<%= form_tag '', :method => :get do %>

Your form is making a POST request to your SearchController, and that is interpreted as a call to the create action. Try using a GET request instead with your form - something like this:

<%= form_tag '', :method => :get do %>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文