| Issue 367: | Sorting search results by Location or Event Name should be case-insensitive | |
| 3 people starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
What steps will reproduce the problem?
1. Search for "lunch 2.0"
2. Sort by Location
What is the expected output?
In the Past Events group, I expect the event at "souk" to appear between
the event at "SAO ..." and the event at "SplashCast"
What do you see instead?
It appears after the event at Weiden & Kennedy. See attached png
The problem is in event.rb in the self.search method. At around line 281:
case order
when :score then events_by_score
when :name, :title then events_by_score.sort_by(&:event_title_for_solr)
when :venue then events_by_score.sort_by(&:venue_title_for_solr)
when :date then events_by_score.sort_by(&:start_time_for_solr)
else raise ArgumentError, "Unknown order: #{order}"
end
The sorts for :name and :venue should be downcased (or upcased), e.g.:
when :name, :title then events_by_score.sort_by{|x|
x.event_title_for_solr.downcase}
when :venue then events_by_score.sort_by{|x|
x.venue_title_for_solr.downcase}
|
||||||||||||||||
,
Jan 29, 2009
Here's a patch for this - it seems more appropriate to me to downcase in the event_title_for_solr/venue_title_for_solr methods. The tests could probably be terser.
Status: PatchSubmitted
|
|||||||||||||||||
,
Jan 31, 2009
Changes look good. Will apply. |
|||||||||||||||||
,
Jan 31, 2009
(No comment was entered for this change.)
Status: Fixed
|
|||||||||||||||||
,
Feb 01, 2009
Reopened issue because previously included spec used the same first letters for the events and associated venues, and thus the sample data didn't describe that these are sorted separately. Attached new patch, that relies this issues's existing patch, that tries to provide comprehensive spec for the two kinds of sorting.
Status: PatchSubmitted
Owner: ben.kerney Cc: igal.koshevoy |
|||||||||||||||||
,
Feb 01, 2009
+1 for the refactor, it's much clearer. I didn't know the :shared => true trick, that's great. |
|||||||||||||||||
|
|
|||||||||||||||||