Skip to content

Commit

Permalink
Fixed Event::search and Event#text_for_solr to use lower-cased string…
Browse files Browse the repository at this point in the history
…s, because apparently Solr is case-sensitive.
  • Loading branch information
igal committed Aug 31, 2009
1 parent 88350dc commit ae53a43
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/models/event.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def self.search(query, opts={})
formatted_query = \ formatted_query = \
%{NOT duplicate_for_solr:"1" AND (} \ %{NOT duplicate_for_solr:"1" AND (} \
<< query \ << query \
.downcase \
.gsub(/:/, '?') \ .gsub(/:/, '?') \
.scan(/\S+/) \ .scan(/\S+/) \
.map(&:escape_lucene) \ .map(&:escape_lucene) \
Expand Down Expand Up @@ -419,9 +420,10 @@ def venue_title_for_solr
self.venue.ergo.title.to_s.downcase self.venue.ergo.title.to_s.downcase
end 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 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 end


#---[ Transformations ]------------------------------------------------- #---[ Transformations ]-------------------------------------------------
Expand Down

0 comments on commit ae53a43

Please sign in to comment.