Rsolr::Ext return undefined method `to_i' for ["10", "10"]:Array

时间:2015-07-28 16:12:34

标签: ruby-on-rails ruby solr rsolr

  • I had a problem about RSolr::Ext.
  • When i try to query with params page and per_page use library rsolr-ext in order to connect to Apache Solr.

And i get an error same as:

NoMethodError: undefined method `to_i' for ["10", "10"]:Array
from /home/khanhpn/.rvm/gems/ruby-2.2.2@music/gems/rsolr-ext-1.0.3/lib/rsolr-ext/response.rb:27:in `rows'

This is my code:

@solr_connection = RSolr::Ext.connect(
  url: "http://localhost:8080/solr/music",
  open_timeout: 10,
  read_timeout: 10,
  retry_503: 2)

solr_params = {
     :page => 0,
     :per_page => 10,
     :field_names => [:id, :title],
     :queries => "xuan"
}

solr_connection.find(solr_params)

Hope that everybody can support me. Thank you very much.

1 个答案:

答案 0 :(得分:0)

我猜问题是使用:field_names密钥,RSolr::Ext#find方法似乎不支持该密钥。您是否误解了:queries:phrases或其他可用的内容?