I am trying to find the word fox
in the sentence The foxy brown fox jumped over the lazy dog
.
Currently, I search using the following SQL:
SELECT *
FROM sentences
WHERE sentence LIKE '%fox%'
This finds the sentence due to the presence of foxy, not just fox. How do I find fox
independently?
I am implementing this search in Ruby on Rails, and so the syntax for the above SQL would be translated to the following:
query = 'fox'
result = Sentence.where("sentence LIKE :search_term", {:search_term => "%#{query}%"})