Here's a sample that will pull (space delimited, mind you) the first 5 words from Post.content
SELECT CONCAT(SUBSTRING_INDEX(content, ' ',5) ,
if(CHAR_LENGTH(content)-CHAR_LENGTH(SUBSTRING_INDEX(content, ' ',5))> 0,
'...',' ') COLLATE utf8_general_ci) as str from Post
I leave it as an exercise to the reader to filter the feeds. NOTE: Post.content already is a short version of the full content. I'd also *suggest* that one might include exit tags as indicated, although it could possibly break TIDY:
SELECT CONCAT(SUBSTRING_INDEX(content, ' ',5) ,
if(CHAR_LENGTH(content)-CHAR_LENGTH(SUBSTRING_INDEX(content, ' ',5))> 0,
'...',' ') COLLATE utf8_general_ci, '</b></u></i></p>' COLLATE utf8_general_ci)
as str from Post
Sentences? change the ' ' to '.' and the count appropriately.
Paragraphs? change the ' ' to '</p>' or '<p>' and the count...
wg-fomATgwyDOTorg |