merging 10098 to the trunk

This commit is contained in:
tworrall 2012-10-05 17:39:36 +00:00
parent 3bc9fd9501
commit 72d2cafc2a
6 changed files with 119 additions and 18 deletions

View file

@ -0,0 +1,52 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.search.controller;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import java.util.Enumeration;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.datatypes.RDFDatatype ;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
public class SearchHelpController extends FreemarkerHttpServlet {
private static final Log log = LogFactory.getLog(SearchHelpController.class.getName());
private static final String TEMPLATE_NAME = "search-help.ftl";
@Override
protected ResponseValues processRequest(VitroRequest vreq) {
Map<String, Object> body = new HashMap<String, Object>();
String pointOfOrigin = "helpLink";
body.put("origination", pointOfOrigin);
return new TemplateResponseValues(TEMPLATE_NAME, body);
}
}

View file

@ -863,11 +863,20 @@
<servlet-name>SearchController</servlet-name> <servlet-name>SearchController</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.search.controller.PagedSearchController</servlet-class> <servlet-class>edu.cornell.mannlib.vitro.webapp.search.controller.PagedSearchController</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>SearchController</servlet-name> <servlet-name>SearchController</servlet-name>
<url-pattern>/search</url-pattern> <url-pattern>/search</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet>
<servlet-name>SearchHelpController</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.search.controller.SearchHelpController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SearchHelpController</servlet-name>
<url-pattern>/searchHelp</url-pattern>
</servlet-mapping>
<!-- for now, need to make sure the links on CALS' site doesn't break --> <!-- for now, need to make sure the links on CALS' site doesn't break -->
<servlet-mapping> <servlet-mapping>
<servlet-name>SearchController</servlet-name> <servlet-name>SearchController</servlet-name>

View file

@ -57,6 +57,14 @@ a:visited span.SearchTerm {
div.searchTips li { div.searchTips li {
line-height: 2em; line-height: 2em;
} }
ul.searchTips {
list-style: url("../images/arrowIcon.gif");
}
ul.searchTips li {
line-height:1.375em;
padding:0 0 8px 0;
margin-left:20px;
}
/* Search results */ /* Search results */
.display-title { .display-title {
font-size: .825em; font-size: .825em;
@ -69,3 +77,9 @@ div.searchTips li {
.display-title:first-child { .display-title:first-child {
margin-left: .5em; margin-left: .5em;
} }
span#searchHelp {
float:right;
margin-top:-45px;
font-size:.825em;
padding-right:32px
}

View file

@ -9,3 +9,4 @@
<p> <p>
${message?html} ${message?html}
</p> </p>
<#include "search-help.ftl" >

View file

@ -1,18 +1,43 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> <#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<h3>Search Tips</h3> <#if origination?has_content && origination == "helpLink">
<ul> <h2>Search Tips</h2>
<li>Use short, single terms unless your searches are returning too many results</li> <span id="searchHelp">
<li>When you enter more than one term, the search will look for records containing <strong>all</strong> of them unless you add the word "OR" between your terms.</li> <a href="#" onClick="history.back();return false;" title="back to results">Back to results</a>
<li>"NOT" can help limit searches -- e.g., <i>climate NOT change</i></li> </span>
<#else>
<h3>Search Tips</h3>
</#if>
<ul class="searchTips">
<li>Keep it simple! Use short, single terms unless your searches are returning too many results.</li>
<li>Use quotes to search for an entire phrase -- e.g., "<i>protein folding</i>".</li>
<li>Except for Boolean operators, searches are not case-sensitive, so <i>Geneva</i> and <i>geneva</i> are equivalent.</li>
<li>Except for boolean operators, searches are <strong>not</strong> case-sensitive, so "Geneva" and "geneva" are equivalent</li> <li>Except for boolean operators, searches are <strong>not</strong> case-sensitive, so "Geneva" and "geneva" are equivalent</li>
<li>Enclose a phrase in quotes (") to search for the whole phrase, not individual words (e.g., "protein folding") -- <i>both leading and ending quotes are required</i></li> <li>If you are unsure of the correct spelling, put ~ at the end of your search term -- e.g., <i>cabage~</i> finds <i>cabbage</i>, <i>steven~</i> finds <i>Stephen</i> and <i>Stefan</i> (as well as other similar names).</li>
<li>Phrase searches may be combined with boolean operators: <i>"climate change" OR "global warming"</i></li>
<li>The search uses <strong>stemming</strong> by default so that close word variations will also be found (e.g., "sequence" also matches "sequences" and "sequencing").
Use the wildcard <strong>*</strong> character to match wider variation (e.g., <strong>nano*</strong> to match both
<i>nanotechnology</i> and <i>nanofabrication</i>), but note that searching uses <i>stemmed</i>, or shortened, versions of words,
so "cogniti*" finds nothing while "cognit*" finds both <i>cognitive</i> and <i>cognition</i></li>
<li>If you're not sure of the spelling, put a <strong>~</strong> at the end -- e.g., <i>cabage~</i> finds <i>cabbage</i>,
<i>steven~</i> finds <i>Stephen</i> and <i>Stefan</i> (as well as a few unwanted extra words)</li>
<li>To match a person or unit's primary entry, enter <i>name: Smith</i> or <i>name: Biology</i></li>
</ul> </ul>
<h4><a id="advTipsLink" href="#">Advanced Tips</a></h4>
<ul id="advanced" class="searchTips" style="visibility:hidden">
<li>When you enter more than one term, search will return results containing all of them unless you add the Boolean "OR" -- e.g., <i>chicken</i> OR <i>egg</i>.</li>
<li>NOT" can help limit searches -- e.g., <i>climate</i> NOT <i>change</i>.</li>
<li>Phrase searches may be combined with Boolean operators -- e.g. "<i>climate change</i>" OR "<i>global warming</i>".</li>
<li>Close word variations will also be found -- e.g., <i>sequence</i> matches <i>sequences</i> and <i>sequencing</i>.</li>
<li>Use the wildcard * character to match an even wider variation -- e.g., <i>nano*</i> will match both <i>nanotechnology</i> and <i>nanofabrication</i>.</li>
<li>Search uses shortened versions of words -- e.g., a search for <i>cogniti*</i> finds nothing, while <i>cognit*</i> finds both <i>cognitive</i> and <i>cognition</i>.</li>
</ul>
<a id="closeLink" href="#" style="visibility:hidden;font-size:.825em;padding-left:8px">Close</a>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/search.css" />')}
<script type="text/javascript">
$(document).ready(function(){
$('a#advTipsLink').click(function() {
$('ul#advanced').css("visibility","visible");
$('a#closeLink').css("visibility","visible");
$('a#closeLink').click(function() {
$('ul#advanced').css("visibility","hidden");
$('a#closeLink').css("visibility","hidden");
});
});
});
</script>

View file

@ -9,7 +9,7 @@
<#if typeName?has_content>limited to type '${typeName}'</#if> <#if typeName?has_content>limited to type '${typeName}'</#if>
</#escape> </#escape>
</h2> </h2>
<span id="searchHelp"><a href="${urls.base}/searchHelp" title="search help">Not the results you expected?</a></span>
<div class="contentsBrowseGroup"> <div class="contentsBrowseGroup">
<#-- Refinement links --> <#-- Refinement links -->