开发者

How to select portion of text like stackoverflow search result do?

开发者 https://www.devze.com 2023-02-10 09:20 出处:网络
I\'m looking for efficient and fast php solution, that can 开发者_Python百科select portion of text from document and slice it based on keywords without loosing meaning of content similar as stack over

I'm looking for efficient and fast php solution, that can 开发者_Python百科select portion of text from document and slice it based on keywords without loosing meaning of content similar as stack overflow search engine do.

I found one similar question for C# but without any examples.

How would you implement such functionality in PHP?


I know this question is old but I hate seeing questions like this go unanswered. Anyway, you need to use a full-text search engine like Sphinx Search. They have a PHP API with the necessary built-in function to automatically markup the selected text. Look up BuildExcerpts() in their API.

I only have experience with Sphinx, however, I am willing to be other Full text engines have this functionality built in as well. The keyword you're looking for is "excerpts".

0

精彩评论

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