Skip to content

Instantly share code, notes, and snippets.

@ryanb
Created April 16, 2009 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanb/96659 to your computer and use it in GitHub Desktop.
Save ryanb/96659 to your computer and use it in GitHub Desktop.
class Article < ActiveRecord::Base
xapit do |index|
index.text :description do |desc|
desc.split.map do |word|
if word.include? '-'
[word, word.gsub('-', ''), word.gsub('-', ' ')]
else
word
end
end.flatten
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment