MySQL Forums
Forum List  »  Full-Text Search

Re: How to get no. of occurence of a word in a row using fulltext.
Posted by: Sapan Mandloi
Date: December 16, 2012 07:33AM

I have a MyISAM table comprising over 2 million records, on which there is a FULLTEXT index over multiple columns.

Given a search term, I would like to know how many times it occurs within the indexed fields of each record.

For example, when searching for 'test' within the following table (in which there is a FULLTEXT index over both the FREETEXT and Third_Col columns):
+----+--------------------------------------------+---------------------------+
| ID | FREETEXT | Third_Col |
+----+--------------------------------------------+---------------------------+
| 1 | This is first test string in test example. | This is first test Values |
| 2 | This is second test. | This is sec col |
+----+--------------------------------------------+---------------------------+

I expect results like:
+----+-------+
| ID | count |
+----+-------+
| 1 | 3 |
| 2 | 1 |
+----+-------+

I know that in the FULLTEXT index MySQL uses dtf (the number of times the term appears in the document); how can one obtain this?

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to get no. of occurence of a word in a row using fulltext.
2309
December 16, 2012 07:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.