범주에 속한 product_details 테이블이 있습니다. product_details에는 id, name, price, discount 및 category_id와 같은 필드가 있으며 categories 테이블에는 id 및 name과 같은 필드가 있습니다. mysql 데이터베이스를 사용하고 있습니다 category_id를 기반으로 그룹 제품 세부 사항을 수행하려고합니다. 그룹화를 수행하려면 https://gist.github.com/f987013b2feec5b28456을 참조하십시오. 그러나sunspot_solr 그룹화 절에서 정의되지 않은 필드 오류
가RSolr::Error::Http - 400 Bad Request
Error: undefined field category_id
내 모델 내 컨트롤러 내 로그 내이
처럼 점점 파일이
def index
@search_res1=ProductDetail.search do
adjust_solr_params do |params|
params[:group] = true
params[:"group.field"] = "category_id"
params[:"group.format"] = "simple"
end
end.execute
@[email protected]_res1.results
end
처럼 보이는이
class ProductDetail < ActiveRecord::Base
belongs_to :category
searchable do
text :name
integer :category_id
end
end
과 같은 다음과 같은 오류 오류가 발생하고 RSolr :: Error :: Http 의 ProductDet 감사 담당자 # index
RSolr::Error::Http - 400 Bad Request Error: undefined field category_id Request Data: "fq=type%3AProductDetail&fq=category_id_i%3A%281%29&start=0&rows=30&group=true&group.field=category_id&group.format=simple&q=%2A%3A%2A" Backtrace: /home/toshiba/.rvm/gems/ruby-1.9.2-p290/gems/rsolr-1.0.8/lib/rsolr/client.rb:230:in `adapt_response' /home/toshiba/.rvm/gems/ruby-1.9.2-p290/gems/rsolr-1.0.8/lib/rsolr/client.rb:167:in `execute' /home/toshiba/.rvm/gems/ruby-1.9.2-p290/gems/rsolr-1.0.8/lib/rsolr/client.rb:161:in `send_and_receive'
도와주세요. 고맙습니다. 여기