I am trying to create a search box where as the user types in their search terms, it constantly assesses whether the search terms are in my content on the fly.
I have an array of search terms and phrases, like such:
["home", "and", "garden", "weeding a flower patch", "best tools"]
I also have a string that contains the content I'm searching in, such as this:
"Using your hands to dig your flower holes brings you closer to the earth."
In Javascript, I need to see if any of the search terms are in any portion of this string. I don't need to know which terms match or where, only that somewhere in that string is at least one instance of one of my search terms. It's very important though that it also finds partial matches in the content string. For example, in the example above, it should return true, because the word "hands" contains the word "and" from my search terms. It's also important that it be done in the fastest, least computationally heavy way, since I will be calling this function thousands of times in a row. How can I best do this?