Split search services
This commit is contained in:
parent
cdcc051d3f
commit
e48b2d7e0f
9 changed files with 7122 additions and 14 deletions
|
@ -37,7 +37,7 @@ public class UrlBuilder {
|
|||
LOGIN("/login"),
|
||||
LOGOUT("/logout"),
|
||||
OBJECT_PROPERTY_EDIT("/propertyEdit"),
|
||||
CUSTOMSEARCH("/customsearch"),
|
||||
EXTENDED_SEARCH("/extendedsearch"),
|
||||
SEARCH("/search"),
|
||||
SITE_ADMIN("/siteAdmin"),
|
||||
TERMS_OF_USE("/termsOfUse"),
|
||||
|
|
|
@ -304,7 +304,7 @@ public class FreemarkerConfigurationImpl extends Configuration {
|
|||
urls.put("home", UrlBuilder.getHomeUrl());
|
||||
urls.put("about", UrlBuilder.getUrl(Route.ABOUT));
|
||||
urls.put("search", UrlBuilder.getUrl(Route.SEARCH));
|
||||
urls.put("customsearch", UrlBuilder.getUrl(Route.CUSTOMSEARCH));
|
||||
urls.put("extendedsearch", UrlBuilder.getUrl(Route.EXTENDED_SEARCH));
|
||||
urls.put("termsOfUse", UrlBuilder.getUrl(Route.TERMS_OF_USE));
|
||||
urls.put("login", UrlBuilder.getLoginUrl());
|
||||
urls.put("logout", UrlBuilder.getLogoutUrl());
|
||||
|
|
|
@ -58,11 +58,11 @@ import edu.ucsf.vitro.opensocial.OpenSocialManager;
|
|||
* Paged search controller that uses the search engine
|
||||
*/
|
||||
|
||||
@WebServlet(name = "CustomSearchController", urlPatterns = {"/customsearch","/customsearch.jsp","/customfedsearch","/customsearchcontroller"} )
|
||||
public class CustomSearchController extends FreemarkerHttpServlet {
|
||||
@WebServlet(name = "ExtendedSearchController", urlPatterns = {"/extendedsearch","/extendedsearch.jsp","/extendedfedsearch","/extendedsearchcontroller"} )
|
||||
public class ExtendedSearchController extends FreemarkerHttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Log log = LogFactory.getLog(CustomSearchController.class);
|
||||
private static final Log log = LogFactory.getLog(ExtendedSearchController.class);
|
||||
|
||||
protected static final int DEFAULT_HITS_PER_PAGE = 25;
|
||||
protected static final int DEFAULT_MAX_HIT_COUNT = 1000;
|
||||
|
@ -74,6 +74,7 @@ public class CustomSearchController extends FreemarkerHttpServlet {
|
|||
private static final String PARAM_CLASSGROUP = "classgroup";
|
||||
private static final String PARAM_RDFTYPE = "type";
|
||||
private static final String PARAM_QUERY_TEXT = "querytext";
|
||||
private static final String EXTENDEDSEARCH = "/extendedsearch";
|
||||
|
||||
protected static final Map<Format,Map<Result,String>> templateTable;
|
||||
|
||||
|
@ -552,9 +553,9 @@ public class CustomSearchController extends FreemarkerHttpServlet {
|
|||
}
|
||||
|
||||
public static class VClassGroupSearchLink extends LinkTemplateModel {
|
||||
long count = 0;
|
||||
long count = 0;
|
||||
VClassGroupSearchLink(String querytext, VClassGroup classgroup, long count) {
|
||||
super(classgroup.getPublicName(), "/customsearch", PARAM_QUERY_TEXT, querytext, PARAM_CLASSGROUP, classgroup.getURI());
|
||||
super(classgroup.getPublicName(), EXTENDEDSEARCH, PARAM_QUERY_TEXT, querytext, PARAM_CLASSGROUP, classgroup.getURI());
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
@ -564,7 +565,7 @@ public class CustomSearchController extends FreemarkerHttpServlet {
|
|||
public static class VClassSearchLink extends LinkTemplateModel {
|
||||
long count = 0;
|
||||
VClassSearchLink(String querytext, VClass type, long count) {
|
||||
super(type.getName(), "/customsearch", PARAM_QUERY_TEXT, querytext, PARAM_RDFTYPE, type.getURI());
|
||||
super(type.getName(), EXTENDEDSEARCH, PARAM_QUERY_TEXT, querytext, PARAM_RDFTYPE, type.getURI());
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
@ -738,15 +739,15 @@ public class CustomSearchController extends FreemarkerHttpServlet {
|
|||
HashMap<Result,String> resultsToTemplates = new HashMap<Result,String>();
|
||||
|
||||
// set up HTML format
|
||||
resultsToTemplates.put(Result.PAGED, "search-pagedResults.ftl");
|
||||
resultsToTemplates.put(Result.ERROR, "search-error.ftl");
|
||||
resultsToTemplates.put(Result.PAGED, "extendedsearch-pagedResults.ftl");
|
||||
resultsToTemplates.put(Result.ERROR, "extendedsearch-error.ftl");
|
||||
// resultsToTemplates.put(Result.BAD_QUERY, "search-badQuery.ftl");
|
||||
table.put(Format.HTML, Collections.unmodifiableMap(resultsToTemplates));
|
||||
|
||||
// set up XML format
|
||||
resultsToTemplates = new HashMap<Result,String>();
|
||||
resultsToTemplates.put(Result.PAGED, "search-xmlResults.ftl");
|
||||
resultsToTemplates.put(Result.ERROR, "search-xmlError.ftl");
|
||||
resultsToTemplates.put(Result.PAGED, "extendedsearch-xmlResults.ftl");
|
||||
resultsToTemplates.put(Result.ERROR, "extendedsearch-xmlError.ftl");
|
||||
|
||||
// resultsToTemplates.put(Result.BAD_QUERY, "search-xmlBadQuery.ftl");
|
||||
table.put(Format.XML, Collections.unmodifiableMap(resultsToTemplates));
|
||||
|
@ -754,8 +755,8 @@ public class CustomSearchController extends FreemarkerHttpServlet {
|
|||
|
||||
// set up CSV format
|
||||
resultsToTemplates = new HashMap<Result,String>();
|
||||
resultsToTemplates.put(Result.PAGED, "search-csvResults.ftl");
|
||||
resultsToTemplates.put(Result.ERROR, "search-csvError.ftl");
|
||||
resultsToTemplates.put(Result.PAGED, "extendedsearch-csvResults.ftl");
|
||||
resultsToTemplates.put(Result.ERROR, "extendedsearch-csvError.ftl");
|
||||
|
||||
// resultsToTemplates.put(Result.BAD_QUERY, "search-xmlBadQuery.ftl");
|
||||
table.put(Format.CSV, Collections.unmodifiableMap(resultsToTemplates));
|
Loading…
Add table
Add a link
Reference in a new issue