Browse files

Fixed Event::search and Event#text_for_solr to use lower-cased string…

…s, because apparently Solr is case-sensitive.
  • Loading branch information...
1 parent 88350dc commit ae53a431c91793527bf0b2ab126d1a863acbeaba @igal igal committed Aug 31, 2009
Showing with 4 additions and 2 deletions.
  1. +4 −2 app/models/event.rb
View
6 app/models/event.rb
@@ -311,6 +311,7 @@ def self.search(query, opts={})
formatted_query = \
%{NOT duplicate_for_solr:"1" AND (} \
<< query \
+ .downcase \
.gsub(/:/, '?') \
.scan(/\S+/) \
.map(&:escape_lucene) \
@@ -419,9 +420,10 @@ def venue_title_for_solr
self.venue.ergo.title.to_s.downcase
end
- # Return a string of all indexable fields, which may be useful for doing duplicate checks
+ # Return a string containing the text of all the indexable fields joined together.
def text_for_solr
- INDEXABLE_FIELDS.reject{|name| name == :text_for_solr}.map{|name| self.send(name)}.join("|").to_s
+ # NOTE: The #text_for_solr method is one of the INDEXABLE_FIELDS, so don't indexing it to avoid an infinite loop. Some fields are methods, not database columns, so use #send rather than read_attribute.
+ (INDEXABLE_FIELDS - [:text_for_solr]).map{|name| self.send(name).to_s.downcase}.join("|").to_s
end
#---[ Transformations ]-------------------------------------------------

0 comments on commit ae53a43

Please sign in to comment.