0
在rails中使用Sunspot Solr。我的代碼看起來如下:sunspot-solr中的結果格式
searchable do
text :title, :stored => true
string :id, :stored => true
integer :status, :stored => true
end
,並在我的控制器,執行搜索後,當我去將其存儲在一個哈希:
one_result= {:title => hit.stored(:title), :id => hit.stored(:id)}
現在,當我做puts one_result.inspect
,我得到:
{"title": ["THIS IS TITLE"]
"id":12345
}
問題是,所有的文本字段都變成了數組[..]
。我想將結果包含在json響應中。我希望它是:
{"title": "THIS IS TITLE"
"id":12345
}
任何幫助嗎?
謝謝..問題解決了:) – smanvi12
請幫我這個:http://stackoverflow.com/questions/31512210/indexing-using-two-tables-in-sunspot-solr-rails-4 – smanvi12