search.jsp revision 1292
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncCDDL HEADER START
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncThe contents of this file are subject to the terms of the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncCommon Development and Distribution License (the "License").
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncYou may not use this file except in compliance with the License.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncSee LICENSE.txt included in this distribution for the specific
deb4998ba50060c48cce222fd18a8eed053918d7vboxsynclanguage governing permissions and limitations under the License.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncWhen distributing Covered Code, include this CDDL HEADER in each
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncfile and include the License file at LICENSE.txt.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncIf applicable, add the following below this CDDL HEADER, with the
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncfields enclosed by brackets "[]" replaced with your own identifying
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncinformation: Portions Copyright [yyyy] [name of copyright owner]
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncCDDL HEADER END
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncCopyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncPortions Copyright 2011 Jens Elkner.
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync--%><%@page session="false" errorPage="error.jsp" import="
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync private StringBuilder createUrl(SearchHelper sh, boolean menu) {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync StringBuilder url = new StringBuilder(64);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync QueryBuilder qb = sh.builder;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync if (menu) {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync Util.appendQuery(url, "sort", sh.order.toString());
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync if (qb != null) {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync if (sh.projects != null && sh.projects.size() != 0) {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync Util.appendQuery(url, "project", cfg.getRequestedProjectsAsString());
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync return url;
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync/* ---------------------- search.jsp start --------------------- */
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync cfg = PageConfig.get(request);
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync long starttime = System.currentTimeMillis();
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync SearchHelper searchHelper = cfg.prepareSearch()
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync .prepareExec(cfg.getRequestedProjects()).executeQuery().prepareSummary();
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync cfg.setTitle("Search Error");
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync response.addCookie(new Cookie("OpenGrokSorting", searchHelper.order.toString()));
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync<div id="page">
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <div id="whole_header">
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <div id="header"><%@
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <div id="Masthead"></div>
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <div id="bar">
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <li><a href="<%= request.getContextPath()
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync %>/"><span id="home"></span>Home</a></li>
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <%-- TODO: jel: IMHO it should be move to menu.jspf as combobox --%>
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <div id="sortfield">
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <label for="sortby">Sort by</label>
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <ul id="sortby"><%
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync StringBuilder url = createUrl(searchHelper, true).append("&sort=");
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync for (SortOrder o : SortOrder.values()) {
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync %><li><span class="active"><%= o.getDesc() %></span></li><%
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync %><li><a href="<%= url %><%= o %>"><%= o.getDesc() %></a></li><%
deb4998ba50060c48cce222fd18a8eed053918d7vboxsync <div id="menu"><%@
deb4998ba50060c48cce222fd18a8eed053918d7vboxsyncinclude file="menu.jspf"
if (searchHelper.errorMsg != null) {
<a href="help.jsp#escaping">escape special characters</a>
with <b>\</b>, or read the <a href="help.jsp">Help</a>
SearchHelper.PARSE_ERROR_MSG.length())) %><%
} else if (searchHelper.hits == null) {
} else if (searchHelper.hits.length == 0) {
List<Suggestion> hints = searchHelper.getSuggestions();
%><p><font color="#cc0000">Did you mean (for <%= hint.name %>)</font>:<%
for (String word : hint.freetext) {
for (String word : hint.refs) {
for (String word : hint.defs) {
<p> Your search <b><%= searchHelper.query %></b> did not match any files.
int start = searchHelper.start;
int max = searchHelper.maxItems;
int totalHits = searchHelper.totalHits;
buf.append("<span class=\"sel\">").append(label).append("</span>");
buf.append("<a class=\"more\" href=\"s?n=").append(max)
buf.append("<<");
buf.append(">>");
buf.append(label);
buf.append("</a>");
slider = buf.toString();
<p class="pagetitle">Searched <b><%= searchHelper.query
searchHelper.order.getDesc() %></p><%
if (slider.length() > 0) {
Results.prettyPrint(out, searchHelper, start, start + thispage);
<p><b>Completed in <%= System.currentTimeMillis() - starttime
if (slider.length() > 0) {
/* ---------------------- search.jsp end --------------------- */
include file="foot.jspf"