我使用的是Rails3.1,并且一直在使用来实现太阳黑子。然而,当我像这样运行搜索时,我遵循的都是正确的(我认为):
class ProductsController < ApplicationController
# GET /products
# GET /products.xml
def index
@search = Product.search do
fulltext params[:search]
end
@products = @search.results
respond_to do |format|
我已将我的模型配置成可供太阳黑子搜索的模型:
enum status: [ :draft, :unreviewed, :reviewed, :publish, :disable, :reject ]
searchable do
text :name, :boost => 5
text :description
integer :status
time :created_at
end
在主计长中:
@search = Product.search do
fulltext params[:search]
with :status, 3
order