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>