Yea that's actually MySQL's fault - ORDER BYs sort like this, i.e.
it's not Ultrasphinx - in fact Sphinx does a case fold for everything
it indexes, stems, etc. You can get around it by using UPPER() but
youll have to find a way to get that through Ultrasphinx or hack the
config file (not recommended).. Easiest thing to do would be to store
everything as lower case and then String.capitalize when needed. If
you need the whole string capitalized:
title.split.map{|s| s.capitalize}.join(" ")
or something like that..
On Tue, Dec 2, 2008 at 1:10 PM, liquid_rails <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> It's been a while since I've posted but I figure somebody in this
> group may be able to help me with this...
>
> I'm searching a database with ultrasphinx and want to return the
> results in alphabetical order, ignoring case. However, with the
> following command, headlines that begin with capital letters always
> come ahead of those that don't. e.g. "Zebra" comes before "apple".
>
> @search=Ultrasphinx::Search.new(:query => @query_string, :filters =>
> filters, :sort_by => 'headline', :sort_mode=>'descending')
>
> Does anyone know how I can get ultrasphinx to IGNORE the case of the
> first letter of the headline when sorting the results? I've thought
> of adding another column to my table, headline_downcase where the
> headline is downcased, and doing a sort on that, but that just eats up
> memory. There's got to be a better way!
>
> Any help would be greatly appreciated!
>
> Thank you,
>
> Cheri
> >
>
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---