I'm building a knowledgebase that searches for articles through a keyword table. When the author creates a new article, the content has all the extraneous noisy words filtered out (a, the, an, or, but, etc) and only the important meaty words are inserted into the keyword search table.
Is there a way that I can determine how many times a keyword is found in a particular column?
Say I have a table named Articles with 2 columns: ID and Keywords.
+-- ID --+---------------- Keywords -----------------+
+ 1 + dogs cats fish dogs animals trees dogs +
+--------+-------------------------------------------+
Is there any way that I can formulate a query to tell me that "dogs" appears 3 times in article ID 1?
This is a query that illustrates what I am trying to do, though I'm fully aware that it doesn't work:
SELECT ID, [number of times a word appears in contents]
AS number_appeared
FROM Articles
WHERE Keywords LIKE "%dogs%"
ORDER BY number_appeared DESC;
Any thoughts? I appreciate it greatly.