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".
精彩评论