I\'m making a search function for my website, which finds relevant results from a database. I\'m looking for a way to count occurrences of a word, but I need to ensure that
I have used the technique as described in the link below. The method uses length
and replace
functions of MySQL.
Keyword Relevance
If you want a search I would advise something like Sphinx or Lucene, I find Sphinx (as an independent full text indexer) to be a lot easier to set up and run. It runs fast, and generates the indexes very fast. Even if you were using MyISAM I would suggest using it, it has a lot more power than a full text index from MyISAM.
It can also integrate (somewhat) with MySQL.
It depends on what DBMS you are using, some allow writing UDFs that could do this.