今天我一直面临着太阳黑子的以下问题。它以前工作但现在神秘地停止了。
当我通过电子邮件搜索时,我输入了该人的姓名,例如mushos32@yahoo.gr
它没有给我任何结果,但是当我在mushos32@
之前写@
或任何其他组合时它会给我这个人的结果(mushso32@y
没有给我结果)。我将链接下面的代码:
UserController index
@users = []
unless params[:search].nil? || params[:search].strip.empty?
@search = User.search do
fulltext params[:search]
end
@users = @search.results
end
@users
的usermodel
searchable do
text :email
end
用户/索引
<%= form_tag users_path, :method => :get do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search" , :email => nil %>
</p>
<% if @users.empty? %>
<p>Your search did not return any results. </p>
<% else %>
<% for user in @users %>
<tr>
<td><%= link_to user.name, user %> <%= link_to user.surname, user %></td>
<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>
<td><%= image_tag user.photo.url(:thumb) %></td>
<td><%= link_to "Connect", friendships_path(:friend_id => user), :method => :post %></td>
</tr>
<%end%>