Hi Craig
There's a couple of approaches for this...
If last name is the only field you'll ever want people searching on, then this
should work:
define_index do
indexes last
has first, DOB
set_property :delta => true
end
For sorting, use :order => "first ASC, DOB ASC" - you don't need a :sort_mode
when using strings for :order.
However, if you want to search on first name as well in other situations, then
you'd want to take this approach:
define_index do
indexes first, :sortable => true
indexes last
has DOB
set_property :delta => true
end
The :order option is the same as above, but instead of search(query, ...), you
want search(:conditions => {:last => query}, ...)
I've left off :sortable => true for last name, but if you need that at other
points, just add it back in.
Hope this helps
--
Pat
On 01/04/2010, at 9:35 PM, Dudebot wrote:
> I'm a little past the total newbie stage, but still very much new to
> Thinking Sphinx. Things are working for very simple queries, and now
> I'd like to do something a tiny bit less simple. I'd like to search
> on 'last' but not on 'first' or 'DOB', but sort on 'first' then 'DOB'
>
> So far I have:
>
> attr_accessible :first, :last, :DOB
> ...
> define_index do
> indexes last, :sortable => true
> set_property :delta => true
> end
>
> def self.search_name( query, page )
> search query, :match_mode => :boolean, :order => :last, :sort_mode
> => :asc, :page => page, :per_page => 10
> end
>
> How do I set it up to sort the results on (but not search) 'first'
> then 'DOB'?
>
> Many TIA,
> Craig
>
> --
> 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.