Hi Mike That post is for float values, not strings... you really shouldn't need to double-up with a field *and* attribute. :sortable => true on the field should be all that's required. Still, at least it's working now.
-- Pat On 06/08/2010, at 11:26 PM, Mike Disuza wrote: > Hi Pat, > I have read the post > http://stackoverflow.com/questions/879267/searching-and-sorting-by-a-float-field-with-thinking-sphinx > > which says that if you want to sort the field then only sortable=>true > will not sort the data but you have to add it in attributes as well, I > don't know why it is required. > So I have modified my indexes like that and it is working perfectly. > > define_index do > indexes :name, :as=> "pname", :sortable => true > indexes description > indexes rate,:sortable => true > indexes neighbourhoods.name, :as=>:neighbourhood > where 'properties.deleted = 0' > has exclusive > has published, :name > has created_at, updated_at > end > > Thanks, > Mike > > > On Aug 6, 6:15 pm, Pat Allan <[email protected]> wrote: >> That'll teach me for being so sure I had the answer ;) >> >> Have you reindexed and restarted Sphinx since adding :sortable to the >> field? >> >> -- >> Pat >> >> On 06/08/2010, at 10:58 PM, Mike Disuza <[email protected]> wrote: >> >>> Hi Pat, >>> I already tried this. Not working >>> "ThinkingSphinx.search "this", :order=> :name" >>> This is whole model(property.rb) fields which I have indexed. >> >>> define_index do >>> indexes :name,:sortable => true >>> indexes description >>> indexes rate,:sortable => true >>> indexes neighbourhoods.name, :as=>:neighbourhood >>> where 'properties.deleted = 0' >>> has exclusive >>> has published >>> has created_at, updated_at >>> end >>> Is there any wrong in this? >> >>> Thanks, >>> Mike >> >>> On Aug 6, 5:53 pm, Pat Allan <[email protected]> wrote: >>>> Hi Mike >> >>>> When you're sorting, use :name, not "name" - if you're using a >>>> string, then Thinking Sphinx behaves a different way (using the >>>> extended sort mode, instead of attribute asc/desc sort mode). >> >>>> So, using a symbol should take care of it all. >> >>>> Cheers >> >>>> -- >>>> Pat >> >>>> On 06/08/2010, at 10:12 PM, Mike Disuza wrote: >> >>>>> Hi, >>>>> No I have only property model and which have these fields to index. >>>>> Thanks, >>>>> Mike >> >>>>> On Aug 6, 4:43 pm, Jim Ruther Nill <[email protected]> wrote: >>>>>> do you any other indexed models? >> >>>>>> On Fri, Aug 6, 2010 at 7:36 PM, Mike Disuza <[email protected]> >>>>>> wrote: >>>>>>> Hi, >>>>>>> I have indexing as follows >>>>>>> "define_index do >>>>>>> indexes :name,:sortable => true >>>>>>> indexes description >>>>>>> has created_at, updated_at >>>>>>> end" >> >>>>>>> Whenever I am doing search like >>>>>>> " ThinkingSphinx.search "this" ". I am getting search result but >>>>>>> whenever I am doing sorting with name like >>>>>>> " ThinkingSphinx.search "this", :order => >>>>>>> "name",:sort_mode=>:desc " I >>>>>>> am not getting any search result. It returns a blank array. >> >>>>>>> Can anyone tell me what is wrong with my code? >> >>>>>>> Thanks, >>>>>>> Tushar >> >>>>>>> -- >>>>>>> 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]<thinking-sphinx >>>>>>> %[email protected]> >>>>>>> . >>>>>>> For more options, visit this group at >>>>>>> http://groups.google.com/group/thinking-sphinx?hl=en. >> >>>>>> -- >>>>>> ------------------------------------------------------------- >>>>>> visit my blog athttp://jimlabs.heroku.com >> >>>>> -- >>>>> 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 athttp://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 >>> athttp://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. > -- 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.
