Rails 3 - Solr doesn't search an items -


in photo model have following simple rule:

  searchable     string :note   end 

and try search string solr (simultaneously in 2 tables). output of solr query in terminal (the first 1 articles, second 1 photos):

solr request (4.8ms) [ path=# parameters={data: fq=type%3a article&q=searched_string&fl=%2a+score&qf=title+content&deftype=dismax&start=0&rows=30 , method: post, params: {:wt=>:ruby}, query: wt=ruby, headers: {"content-type"=>"application/x-www-form-urlencoded; charset=utf-8"}, path: select, uri: http://localhost:8982/solr/select?wt=ruby, open_timeout: , read_timeout: } ]

and this

solr request (4.4ms) [ path=# parameters={data: fq=type%3a photo&q=asgasg&fl=%2a+score&deftype=dismax&start=0&rows=30 , method: post, params: {:wt=>:ruby}, query: wt=ruby, headers: {"content-type"=>"application/x-www-form-urlencoded; charset=utf-8"}, path: select, uri: http://localhost:8982/solr/select?wt=ruby, open_timeout: , read_timeout: } ]

controller:

@articles = article.search   fulltext params[:search] end @photos = photo.search   fulltext params[:search] end ## => searching ## puts @articles.results #work fine puts @photos.results #always 0 

i totally don't know, why solr doesn't search in photo model... should specified , set up, still don't know, problem...

i think in photo model have define :note text type (not string) in order run fulltext search on it:

searchable   text :note end 

also, set @articles , @photos, checking @users , @photos in question.

update

according sunspot readme:

"text fields full-text searchable. other fields (e.g., integer , string) can used scope queries"

that is, run fulltext or keywords on field, has declared text in searchable block. have string, can used exact match using with().

good luck.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -