The full-text search has always been a key technology in web, how to find the information you want in the information of the Hao Shihai's information is the most concerned. Ding Ding's Google is a very successful example, people on the Internet use Google to find what they need. The full text search mainly has two technical indicators: fast and accurate. I did a news system for a while, and the boss had a full-text search function, and I thought it was only used for a long time. Now share it, hope is to throw bricks, if you have a better way, please follow :)
Let me introduce my news system: Database's basic information, such as title, publisher, release time, and file name of the main news. The news main body is a static page in the HTML format (the first is to increase the speed, reduce the pressure of the database. The second is that there is a problem when the database handles large strings.). The idea of full text is: first search all the news from the database, find the main news, and then read the main news to a string through the IO operation. Remove the extra thing, like HTML marks what, use the regular expression to find this string, if you find the requirements, you record this news. Finally, returns all eligible news display to the user.
The following code is the code that enters the query condition, query the keyword " " separated: Search.jsp