MySQL Forums
Forum List  »  Full-Text Search

Re: How to get no. of occurence of a word in a row using fulltext.
Posted by: Rick James
Date: December 23, 2012 10:59AM

I don't believe you can get the count from a FULLTEXT search. The metric available from MATCH is more complex -- it takes into account the length of the field being searched.

3 occurrences in a 100-word field is more significant than 3 occurrences in a 10000-word field.

For a single word ('test') in a single column (`freetext`):
SELECT
( CHAR_LENGTH(REPLACE('test', '', `freetext`) -
CHAR_LENGTH(freetext)) ) /
CHAR_LENGTH('test')
FROM tbl ...;
should give you the number of occurrences of 'test'. Unfortunately, it will include "retest".

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to get no. of occurence of a word in a row using fulltext.
2465
December 23, 2012 10:59AM


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.