I set up a pretty much identical model on my local machine, and everything worked fine... so I guess the first thing to check is, did you re-index and restart Sphinx after adding the explicit :type settings?
Mind you, it worked fine for me with and without the :type - are you using MySQL? Or PostgreSQL? -- Pat On 30/12/2009, at 4:46 AM, djfobbz wrote: > Sorry, my index setup is the following (the one listed above is > incorrect): > > define_index do > indexes :name, :sortable => true > has :population, :type => :integer > has :has_description, :type => :integer > has :has_website, :type => :integer > set_property(:morphology => 'stem_en') > set_property(:ignore_chars => 'U+0027') > set_property(:enable_star => true) > end > > On Dec 29, 12:44 pm, djfobbz <[email protected]> wrote: >> I have a Listings model that has description (text) and website >> (string) columns along with corresponding has_description (boolean) & >> has_website (boolean) columns to give precedence (0 for not present >> and 1 for present) during search time accordingly. I have defined >> these boolean columns as integer to allow be to sort them ASC or DESC >> based on 1 or 0. My index setup is as below: >> >> define_index do >> has :has_description, :type => :integer >> has :has_website, :type => :integer >> set_property(:morphology => 'stem_en') >> set_property(:ignore_chars => 'U+0027') >> set_property(:enable_star => true) >> end >> >> Search Code: >> @listings = Listing.search(params[:q], :order => "has_description >> DESC, has_website DESC, name ASC, population DESC", :page => params >> [:page]) >> >> My problem is that when I have both has_description and has_website as >> columns to sort by, I get no results back. However, when I just list >> 1 or the other as below: >> >> @listings = Listing.search(params[:q], :order => "has_description >> DESC, name ASC, population DESC", :page => params[:page]) >> >> I get search results. Any ideas why? > > -- > > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
