I'm writing a small search engine where search queries will be in the form of questions or statements. For example "I have a receding hairline" or "what should I use for a receding hairline?". I intend for the search query to be filtered such that only the relevant words are left ("receding hairline") and the other irrelevant words used to formulate the question or statement are discarded. What will remain is a list of 1 or more words to be used to retrieve appropriate results from a database of keywords. My question pertains to how I would go about searching the database for every possible permutation of the remaining string of words. For example, if I am left with the string "receding hairline", I need to search the database for "receding", "hairline", "receding hairline" and "hairline receding".