Re: MySQL - counting number of instances of a word in a field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The functions do not exist.
However, FULLTEXT indexes will do much of this work for you. I encourage you
to experiment with them.

_________________________
----- Original Message -----
From: "Gavin Amm" <Gavin@xxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Wednesday, April 28, 2004 7:18 AM
Subject:  MySQL - counting number of instances of a word in a field


Hi guys,

I'm trying to find a MySQL function(s) that will allow me to count the
number of words in a field.

For eg:

[table: pages]
id - title - keywords - body
1 - Home - home, page - This is my home page. <p> Enjoy your stay.
2 - Feedback - feedback, form, contact - Please enter any feedback or
comments in the form below.<br>Your feedback will be used to improve our
service.

How do I, for example, count the number of instances of a word such as
"feedback" in say the BODY field?
I'm putting together a search engine & I'd like to 'rank' the results
based on the number of instances of each word found in a few fields.

In this example, if they search for the words "feedback" and "improve",
the count would result in the row id, word searched and the number of
instances of that word:
(formatting doesn't matter, it's just to give you an idea)
  id 2: "feedback" count = 2
  id 2: "improve" count = 1

I can play with the weightings later, just need to figure out the
counting...

Thanks guys,
Gav

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux