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 is a static page in HTML format (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 then read the news of the subject into a string through Io operations. Remove unnecessary things, such as HTML tags, and use regular expressions to search for the string. If the matching information is found, record the news. Finally, all qualified news is returned to the user.
The following code is used to enter the query conditions. The query keywords are separated by "+": search. jsp
<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" onsubmit = "Return subform ()">
<Table width = "600" bgcolor = "# f0f6e2">
<Tr>
<TD colspan = "4" Height = "10"> </TD>
</Tr>
<Tr>
<TD width = "14%"> enter the query Keyword: </TD>
& Lt; TD align = "Left" width = "65%" & gt;
<Input size = "50" 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"> Note: if multiple query conditions exist, separated by </font> <font size = "+ 2"> + </font> <font color = "red" size = "+ 1">. Example: 1 + 2 + 3 + 4... </font> </TD>
</Tr>