My favorites | Sign in
Logo
          
New issue | Search
for
| Advanced search | Search tips
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
Status:  PatchSubmitted
Owner:  ben.kerney
Cc:  igal.koshevoy
Type-Defect
Priority-Low
Simple
Component-UI
Component-searches


Sign in to add a comment
 
Reported by jdcohenesq, Jan 28, 2009
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}
   




souk.PNG
51.2 KB   View   Download
Comment 1 by ben.kerney, 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.
make_event_sorting_case-insensitive.patch
3.2 KB   Download
Status: PatchSubmitted
Comment 2 by spinnerin, Jan 31, 2009
Changes look good. Will apply.
Comment 3 by spinnerin, Jan 31, 2009
(No comment was entered for this change.)
Status: Fixed
Comment 4 by igal.koshevoy, 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.
improved-event_spec-examples-for-case-insensitive-sorting.patch
4.2 KB   Download
Status: PatchSubmitted
Owner: ben.kerney
Cc: igal.koshevoy
Comment 5 by ben.kerney, Feb 01, 2009
+1 for the refactor, it's much clearer. I didn't know the :shared => true trick,
that's great.
Sign in to add a comment

Hosted by Google Code