Full-text search in JSP

Source: Internet
Author: User

 

Full-text search in jsp (preferred for SUN Enterprise applications)

Full-text search has always beenWebPeople are most concerned about how to find the information they want in the vast amount of information. The most famousGOOGLEIs a very successful example, most people on the network useGOOGLETo find the content you need. Full-text search has two major technical indicators: fast and accurate. Some time ago, I made a news system. The boss had to add the full-text retrieval function and thought about it for a long time before using a very clever method. Now let's share it with you. I hope you can introduce it to others. If you have a better solution, please stay behind :)

First, let's introduce my news system: the basic information of news stored in the database, such as the title, publisher, release time, and name of the main news file. The news subject isHtmlFormat static pages (the first is to increase the speed and reduce the pressure on the database. The second problem occurs when the database processes large strings .). The idea of full-text search is: first retrieve all the news from the database, find the news of the subject, and thenIoThe operation reads the subject news into a string. Remove unnecessary items, suchHtmlMark something, and use a regular expression to search for the string. If the matching information is found, the news is recorded. Finally, all qualified news is returned to the user.

The following code is used to enter the query conditions."+"SeparateSearch. jsp (preferred for SUN Enterprise applications)

<Html>

<Head>

<Link rel = "stylesheet" href = "css/style3.css">

<Title>News search</Title>

<Script language = "javascript">

Function subform ()

{

 If (document. zl_form.keyword.value = "")

 {

Alert ("Enter a keyword!");

Document. zl_form.keyword.focus ();

Return false;

 }

 Return true;

}

</Script>

</Head>

<Body bgcolor = "# F0F6E2">

<Form name = "zl_form"Target = "_ new" method = "post" action = "aftsearch. jsp (preferred for SUN Enterprise Applications)" onsubmit = "return subform ()">

<Table width = "600" bgcolor = "# F0F6E2">

<Tr>

<Td colspan = "4" height = "10"> & nbsp; </td>

</Tr>

<Tr>

 & Lt; td width = "14%" & gt;Input Query

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.