Error when try to find_by_solr

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Error when try to find_by_solr

solruser-2
Hi everyone,

Below is the error the I received when I tried to query the solr using find_by_solr. below bold shows where I output the response header from the solr server

>> Post.find_by_solr("amit")
query "(amit) AND type_t:Post"
response "{'responseHeader'=>{'status'=>0,'QTime'=>0,'params'=>{'fl'=>'pk_i','q'=>'(amit) AND type_t:Post','wt'=>'ruby'}},'response'=>{'numFound'=>1,'start'=>0,'docs'=>[{'pk_i'=>ae5a8W7DOr25GRabmcoL7T}]}}"
./script/../config/../config/../vendor/plugins/acts_as_solr/lib/class_methods.rb:181:in `process_query'

(eval):1:in `process_query'
./script/../config/../config/../vendor/plugins/acts_as_solr/lib/class_methods.rb:38:in `eval'
./script/../config/../config/../vendor/plugins/acts_as_solr/lib/class_methods.rb:181:in `process_query'
./script/../config/../config/../vendor/plugins/acts_as_solr/lib/class_methods.rb:38:in `find_by_solr'
(irb):6:in `irb_binding'
c:/ruby/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
c:/ruby/lib/ruby/1.8/irb/workspace.rb:52
RuntimeError: There was a problem executing your search: undefined local variable or method `ae5a8W7DOr25GRabmcoL7T' for Post:Class
        from ./script/../config/../config/../vendor/plugins/acts_as_solr/lib/class_methods.rb:186:in `process_query'
        from ./script/../config/../config/../vendor/plugins/acts_as_solr/lib/class_methods.rb:38:in `find_by_solr'
        from (irb):6On Apr 12, 5:00 pm, "amit" <rohatg...@gmail.com> wrote:

Can someone help me why is this an issue.


TIA
amit
Reply | Threaded
Open this post in threaded view
|

Re: Error when try to find_by_solr

Yonik Seeley-2
On 4/18/07, solruser <[hidden email]> wrote:

> Below is the error the I received when I tried to query the solr using
> find_by_solr. below bold shows where I output the response header from the
> solr server
>
> >> Post.find_by_solr("amit")
> query "(amit) AND type_t:Post"
> response
> "{'responseHeader'=>{'status'=>0,'QTime'=>0,'params'=>{'fl'=>'pk_i','q'=>'(amit)
> AND
> type_t:Post','wt'=>'ruby'}},'response'=>{'numFound'=>1,'start'=>0,'docs'=>[{'pk_i'=>ae5a8W7DOr25GRabmcoL7T}]}}"

It possibly looks like you might have hit a bug in the ruby response writer?
What is the fieldType of field pk_i?  Could you post the field
definition of *_i and it's corresponding fieldType?

You could also verify the problem with the following direct query (and
look for a correct value of pk_i):
http://localhost:8983/solr/select?q=(amit) AND
type_t:Post&wt=ruby&fl=pk_i&indent=on

-Yonik
Reply | Threaded
Open this post in threaded view
|

Re: Error when try to find_by_solr

solruser-2
Hi Yonik,

I verified the url that mentioned in the mail and I got the right result on the uri.

The field type for the primary key field is string. And below is the definition for *_i in the schema.xml file

<fields>
   <field name="id" type="string" indexed="true" stored="true"/>
   <field name="default" type="text" indexed="true" stored="false" multiValued="true"/>
   <dynamicField name="*_i" type="integer" indexed="true" stored="true"/>
   <dynamicField name="*_t" type="text" indexed="true" stored="true"/>
   <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
   <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
   <dynamicField name="*_d" type="date" indexed="true" stored="true"/>
   <dynamicField name="*_s" type="string" indexed="true" stored="true"/>
   <dynamicField name="*_ri" type="sint" indexed="true" stored="true"/>
   <dynamicField name="*_rf" type="sfloat" indexed="true" stored="true"/>
   <dynamicField name="*_facet" type="string" indexed="true" stored="true"/>
 </fields>

-Amit

Yonik Seeley wrote
On 4/18/07, solruser <solruser@gmail.com> wrote:
> Below is the error the I received when I tried to query the solr using
> find_by_solr. below bold shows where I output the response header from the
> solr server
>
> >> Post.find_by_solr("amit")
> query "(amit) AND type_t:Post"
> response
> "{'responseHeader'=>{'status'=>0,'QTime'=>0,'params'=>{'fl'=>'pk_i','q'=>'(amit)
> AND
> type_t:Post','wt'=>'ruby'}},'response'=>{'numFound'=>1,'start'=>0,'docs'=>[{'pk_i'=>ae5a8W7DOr25GRabmcoL7T}]}}"

It possibly looks like you might have hit a bug in the ruby response writer?
What is the fieldType of field pk_i?  Could you post the field
definition of *_i and it's corresponding fieldType?

You could also verify the problem with the following direct query (and
look for a correct value of pk_i):
http://localhost:8983/solr/select?q=(amit) AND
type_t:Post&wt=ruby&fl=pk_i&indent=on

-Yonik
Reply | Threaded
Open this post in threaded view
|

Re: Error when try to find_by_solr

Yonik Seeley-2
On 4/18/07, solruser <[hidden email]> wrote:


>    <dynamicField name="*_i" type="integer" indexed="true" stored="true"/>

The root of the problem is that your "integer" field did not have an
integer in it.
Did you change the type of the schema after you indexed the data?  If
so, start over.
The other possibility is that when you added the data, you put in a
non integer value for pk_i.

-Yonik