Implementing Full-text Search in JSP

Source: Internet
Author: User
Tags html tags query return string
js| Full-text Search

Let me introduce my news system: The basic information of the database, such as title, publisher, release time, main news file name. The news subject is a static page in HTML format (the first is to increase the speed and reduce the pressure on the database.) The second is that the database handles large strings with problems. )。 The idea of full text search is: first from the database to retrieve all the news, the main news found, and then through IO operation of the main news read into a string. Then remove the extra stuff, like HTML tags, and then use regular expressions to find the string, and if you find the right information, record the news. The final return of all eligible news is displayed to the user.

The following code is the code to enter the query criteria, the query keyword separated by "+": search.jsp

<link rel= "stylesheet" href= "Css/style3.css" >

<title> News Search </title>

<script language= "JavaScript" >

Function Subform ()

{

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

{

Alert ("Please enter the keyword!") ");

Document.zl_form.keyword.focus ();

return false;

}

return true;

}

</script>

<body bgcolor= "#F0F6E2" >

<form name= "Zl_form" target= "_new" method= "post" action= "aftsearch.jsp" >

<table width= "bgcolor=" "#F0F6E2" >

<tr>

<TD colspan= "4" height= "ten" > </td>

</tr>

<tr>

<TD width= "14%" > Input query Keywords:</td>

<TD align= "left" width= "65%" >

<input size= "type=" "text" name= "keyword" style= "font-size:9pt" >

<input type= "Submit" name= "submit" value= "search" style= "font-size:9pt" >

</td>

</tr>

<tr>

<TD colspan= "2" height= "9" align= "left" >

<br>

<font color= "Red" size= "+1" > Description: If there are multiple query conditions, the middle with </font><font size= "+2" >+</font><font color= "Red" size= "+1" > separated. such as:1+2+3+4...</font></td>

</tr>



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.