开发者

Full Text Search - Select first lines

开发者 https://www.devze.com 2023-01-12 20:19 出处:网络
I have an application who saves some files in an sql开发者_如何转开发 database. I\'m using Full text search for filtering on the documents, now i wonder if it\'s possible to select the first lines of

I have an application who saves some files in an sql开发者_如何转开发 database. I'm using Full text search for filtering on the documents, now i wonder if it's possible to select the first lines of a document? So i can make a sort of "google" page for my application


Try this SQL. This will give you first 255 characters from the table which match the columnname againg query.

 SELECT SUBSTR(`columnname`, 0, 255) AS blurb FROM `tablename` WHERE MATCH (`columnname`) AGAINST('query');

Then, you can disaply the blurb as first few lines of the document.

0

精彩评论

暂无评论...
验证码 换一张
取 消