<%@ plsql procedure="search_html" %>
<%@ plsql parameter="query" default="null" %>
<%! v_results number := 0; %>
<html>
<head>
<title>search_html Search </title>
</head>
<body>
<%
IF query IS NULL THEN
%>
<center>
<form method="post" action="search_html">
<b>Search for: </b>
<input type="text" name="query" size="30">
<input type="submit" value="Search">
</center>
<hr>
<%
ELSE
%>
<p>
<%!
color varchar2(6) := 'ffffff';
%>
<center>
<form method="post" action="search_html">
<b>Search for:</b>
<input type="text" name="query" size="30" value="<%= query %>">
<input type="submit" value="Search">
</form>
</center>
<hr>
<p>
<%
-- select statement
FOR DOC IN (
SELECT /*+ DOMAIN_INDEX_SORT */ rowid, tk, title, score(1) scr
FROM search_table
WHERE CONTAINS(text, query,1) >0
ORDER BY score(1) DESC
)
LOOP
v_results := v_results + 1;
IF v_results = 1 THEN
%>
<center>
<table border="0">
<tr bgcolor="#6699CC">
<th>Score</th>
<th>Title</th>
</tr>
<% END IF; %>
<tr bgcolor="#<%= color %>">
<td> <%= doc.scr %>% </td>
<td> <%= doc.title %>
[<a href="search_htmlServices.showHTMLDoc?p_id=
<%= doc.tk %>">HTML</a>]
[<a href="search_htmlServices.showDoc?p_id=
<%= doc.tk %>&p_query=<%= query %>">Highlight</a>]
</td>
</tr>
<%
IF (color = 'ffffff') THEN
color := 'eeeeee';
ELSE
color := 'ffffff';
END IF;
END LOOP;
%>
</table>
</center>
<%
END IF;
%>
</body>
</html>