Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3 - Solr doesn't search an items
    text
    copied!<p>In the <strong>Photo</strong> model I have following simple rule:</p> <pre><code> searchable do string :note end </code></pre> <p>and I try to search some string with <strong>Solr</strong> (simultaneously in two tables). This is the output of <strong>Solr query</strong> in the terminal (the first one for <strong>Articles</strong>, the second one for <strong>Photos</strong>):</p> <blockquote> <p>SOLR Request (4.8ms) [ path=# parameters={data: fq=type%3A <strong>Article&amp;q=searched_string&amp;fl=%2A+score&amp;qf=title+content&amp;defType=dismax&amp;start=0&amp;rows=30</strong> , method: post, params: {:wt=>:ruby}, query: wt=ruby, headers: {"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}, path: select, uri: <a href="http://localhost:8982/solr/select?wt=ruby" rel="nofollow">http://localhost:8982/solr/select?wt=ruby</a>, open_timeout: , read_timeout: } ]</p> </blockquote> <p>and this</p> <blockquote> <p>SOLR Request (4.4ms) [ path=# parameters={data: fq=type%3A <strong>Photo&amp;q=asgasg&amp;fl=%2A+score&amp;defType=dismax&amp;start=0&amp;rows=30</strong> , method: post, params: {:wt=>:ruby}, query: wt=ruby, headers: {"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}, path: select, uri: <a href="http://localhost:8982/solr/select?wt=ruby" rel="nofollow">http://localhost:8982/solr/select?wt=ruby</a>, open_timeout: , read_timeout: } ]</p> </blockquote> <p>controller:</p> <pre><code>@articles = Article.search do fulltext params[:search] end @photos = Photo.search do fulltext params[:search] end ## =&gt; searching ## puts @articles.results #work fine puts @photos.results #always 0 </code></pre> <p>I totally don't know, why SOLR doesn't search in the <strong>Photo</strong> model... everything should be specified and set up, but still don't know, where is the problem...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload