<%--
  Copyright 2003 Sun Microsystems, Inc. All rights reserved 
  Use is subject to license terms.
 --%>
<%-- @(#)searchOnly.jsp --%>
<%@page language= "java" import="com.sun.portal.search.providers.*" %>

<%@page errorPage="error.jsp" %>

<%@ taglib uri="/tld/search.tld" prefix="search" %> 
<%@ taglib uri="/tld/jx.tld" prefix="jx" %> 

<jsp:useBean id="formbean" scope="request" class="SearchRequestBean"> 
<jsp:setProperty name="formbean" property= "*"/> 
</jsp:useBean>

<!-- Beginning of Main search section -->
<search:searchContext>
<search:setQueryLanguage ql= "search"/>
<search:setRDMType rdmType= "rd-request"/>
<search:setRDMServer rdmServer= "$searchServer"/>
<search:setViewHits viewHits= "$hitNumber"/>
<search:setViewAttributes viewAttributes= "hl-url,hl-title,title,hl-description,score,content-length,classification,hl-classification,hl-rd-reference-id,rd-reference-id,rd-rating,rd-sum-rating,rd-peak-rating,rd-num-rating"/>
<search:setCategory category= "<%=formbean.getBrowseCategory()%>"/>
<search:setSessionID sessionID="$accessToken"/>
<%
String t = (String) request.getParameter("proxySso");
if (t != null) {
	pageContext.setAttribute("proxySso",t);
%>
<search:setSessionID sessionID="$proxySso"/>
<%
}
%>
<search:setPage page= "<%=new Integer(formbean.getPage()).toString()%>"/>

<% if (formbean.getScat().equals("cat")) { %>
   <search:setSearchAll searchAll="false"/>
<% } %>

<%
String[] db = request.getParameterValues("database"); 
if (db == null) {
  db = new String[1];
  db[0] = "default";
}

for (int i = 0; i < db.length; i++) { %>
    <search:setDatabase database= "<%=db[i]%>"/>
    <% // Used only 'search within discussion' - should be removed
    String sd = request.getParameter("searchdiscussion");
    if (sd != null) {
	String did = request.getParameter("did");
	if (did != null)
	    formbean.setSearchDiscussionQuery(sd, did);
    }
    %>

    <% if (formbean.getMode().equals("adv")) { %>
	<jsp:include page="advQuery.jsp" flush="true" />
    <% } else { %>
	<search:setQuery query= "<%=formbean.getScope()%>"/>
    <% } %>
    <search:executeSearch/>
    <search:getNoHits id="noHits"/>
    <%--
    <jx:choose>
    <jx:when test="$noHits">
    </jx:when>
    <jx:otherwise>
    --%>
    <search:getResult id="resultstream" scope="request"/>
    <jsp:include page="results.jsp" flush="true"/>
    <%--
    </jx:otherwise>
    </jx:choose>
    --%>
<% } %>
</search:searchContext>
