<%@ page contentType="text/html; charset=UTF-8" errorPage="./errors/internal-error.jsp" import="si.noviforum.jsp2.FormParameterNames,si.noviforum.jsp2.search.SearchHandler,si.noviforum.jsp2.search.SearchResult,si.noviforum.TxtIndex5.Index.*" %><%-- $Id: custom.jsp,v 1.3 2004/08/28 12:54:35 alesp Exp $ Search page: queries the SearchBean for results required by CustomSearchForm. $Author: alesp $ $Date: 2004/08/28 12:54:35 $ $Revision: 1.3 $ $State: Exp $ Based on search.jsp by Primoz Hrvatin. Adjusted and tweaked by David Vevar. Further tweaked by Grega Bremec. --%><%@ include file="include/InitJspService.jsp" %><%@ include file="include/InitSearchBean.jsp" %><%@ include file="include/InitFrontendProperties.jsp" %><% String refToBaseDir = "."; String referer = request.getHeader("referer"); if (referer == null || referer.length() == 0) { referer = refToBaseDir + "/"; } %><% // Tole se nastavi na false v primeru, da noHits[i] <= 0 boolean searchOK = true; String query = searcher.getQuery(); String[] availableShortTitles = searcher.getAvailableShortTitles(); String[] availableCatalogs = searcher.getAvailableCatalogs(); boolean isQuickPreview = request.getParameter(FormParameterNames.FP_QPRID) != null; boolean isQBE = request.getParameter(FormParameterNames.FP_QBEID) != null; boolean isCustomForm = request.getParameter("custom_form") != null; %><% if (isCustomForm) { %><%@ include file = "trident/processadvanced.jsp" %><% query = searcher.getRealQuery(); } %><%= fep.getHtmlProlog() %> <%@ include file="include/MetaInfo.jsp" %><%@ include file="include/StyleTemplate.jsp" %> <%= fep.getFrontendTitle() %>: <%= (isQuickPreview ? "Quick Preview" : "Results") %> <%@ include file="include/PageHeader.jsp" %>

<%@ include file="include/CustomSearchForm.jsp" %>
<% if (query == null || query.length() == 0) { %>
Malformed search terms.

You entered no search query! Please enter one or more search terms.


<% } else { //Iskanje po slikah (iscemo po #contenttype images/*). String appendToQueryString = null; if(query != null && "true".equalsIgnoreCase(request.getParameter("img"))) { appendToQueryString= "#contenttype image/*"; } //Iskanje samo po scsmath.com in scsmath.org domeni String searchBy = request.getParameter("searchBy"); if (searchBy == null) { searchBy="scsmath"; } if ("scsmath".equalsIgnoreCase(searchBy ) ) { if(appendToQueryString != null) { appendToQueryString = "(#contenttype image/*) AND ((#host .com.scsmath.*)OR(#host .com.scsmath)OR(#host .org.scsmath.*)OR(#host .org.scsmath)OR(#host .net.scsmath.*)OR(#host .net.scsmath))"; } else { appendToQueryString = "(#host .com.scsmath.*)OR(#host .com.scsmath)OR(#host .org.scsmath.*)OR(#host .org.scsmath)OR(#host .net.scsmath.*)OR(#host .net.scsmath)"; } } // spremenimo query ce je to potrebno if (appendToQueryString != null) { searcher.setQuery("(" + new String(query.getBytes("UTF-8"), "ISO8859_1") + ") AND (" + appendToQueryString + ")" ); } // ordinary (i.e. ungrouped) ranked search (default) int[] noHitsInCatalog = searcher.doSearch(); if(isQuickPreview) { // %><% } else { // Searching is done on one (0th) catalog. Hence i = 0. int i = 0; int noHits = noHitsInCatalog[i]; if (noHits > 0) { /////////// result list ///////////// SearchResult[] searchResults = searcher.getSearchResults(i); // if there are no hits -> internal error if (searchResults == null || searchResults.length == 0) throw new Exception("Error getting results."); // number of hits <= RANKED_LIST_SIZE int rlSize = searcher.getRecNoSize(i); // index of first hit on this page int firstHit = searcher.getFirstHit(); // number of hits on this page int hitsPerPage = searcher.getHitsPerPage(); // index of last hit on this page int hitsDisplayed = firstHit + hitsPerPage - 1; %>
Hits <%= firstHit %>-<%= (rlSize > hitsDisplayed) ? hitsDisplayed : rlSize %> of <%= noHits %> ordered by system. <%@ include file="include/NavDistinct.jsp" %>

    <% // result list for (int j=0; j < searchResults.length; j++) { SearchResult mResult = searchResults[j]; Object oResult = mResult.result; %>
  • <%@ include file="trident/TridentResult.jsp" %> <% } %>

<%@ include file="include/PageLinks.jsp" %>

<% } else { // no hits found or some other error if (noHits <= 0) { searchOK = false; } switch (noHits) { case 0: %>
No hits.

You could try relaxing your search by leaving out some extremely uncommon words, letting go of difficult AND/OR conditions, and similar.


[back]
<% break; case SearchHandler.RC_TOO_MANY_HITS: %>
Too many hits.

Please try tightening your search by being as specific as you can. You could, on the other hand, try our ">advanced search which enables you to take advantage of the full power of this index.


[back]
<% break; case SearchHandler.RC_DATA_OBSOLETE: %>
Data obsolete.

Information for this request had become obsoleted.


[back]
<% break; case SearchHandler.RC_BAD_SEARCH_QUERY: %>
Malformed search terms.

Your search terms are invalid (malformed). Please use our ">advanced search form if you are not sure about which special forms of syntax to use.


[back]
<% break; case SearchHandler.RC_ERROR: // this error happens whenever IndexDirectory dies, and IndexServer // refresh hadn't yet been performed %>
Searching unavailable.

Sorry, the search engine is currently unavailable. It might be that the entire index collection is undergoing some maintenance, in which case you should probably retry at some later instance.


[back]
<% break; case SearchHandler.RC_INVALID_CATALOG: // this might happen if an invalid catalog was infact specified (perhaps // as a part of the malformed URL -- "ct" field), or if the IndexServer // refresh happened already and the main IndexDirectory died, which we // check just below with "idIsDead" variable. boolean idIsDead = (availableCatalogs == null || availableCatalogs.length == 0); if (idIsDead && fep.getRedirectOnFail()) throw new si.noviforum.jsp2.AggIndexDirectoryDead( "SearchBean reports that \"AvailableCatalogs == null/zero-length\",\n" + "but a search was performed prior to that as a part of current request.\n" + "Therefore, most probably, AggIndexDirectory is dead.", "Frontend Out of Order.", refToBaseDir ); %>
<%= (idIsDead ? "Searching unavailable." : "Obsolete or invalid catalog.") %>

<% if (idIsDead) { %>

Sorry, the search engine is currently unavailable. It might be that the entire index collection is undergoing some maintenance, in which case you should probably retry at some later instance.

<% } else { %>

Sorry, the catalog (index) you were trying to search in is currently unavailable. It might be that one or more of the indexes are undergoing some maintenance, in which case you should probably retry at some later instance.

<% } %>

[back]
<% break; } } } } %>
<%@ include file="include/CustomPageFooter.jsp" %> <% if (searchOK) { %> <% } %>