Cleaned custom search controller
This commit is contained in:
parent
d6eb01de9c
commit
a6fa88bd1f
1 changed files with 0 additions and 42 deletions
|
@ -10,10 +10,8 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
|
@ -41,7 +39,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupsForRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngine;
|
||||
|
@ -56,9 +53,6 @@ import edu.cornell.mannlib.vitro.webapp.web.templatemodels.LinkTemplateModel;
|
|||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult.IndividualSearchResult;
|
||||
import edu.ucsf.vitro.opensocial.OpenSocialManager;
|
||||
|
||||
import org.apache.jena.query.QuerySolution;
|
||||
import org.apache.jena.query.ResultSet;
|
||||
import org.apache.jena.rdf.model.Literal;
|
||||
/**
|
||||
* Paged search controller that uses the search engine
|
||||
*/
|
||||
|
@ -80,18 +74,6 @@ public class CustomSearchController extends FreemarkerHttpServlet {
|
|||
private static final String PARAM_RDFTYPE = "type";
|
||||
private static final String PARAM_QUERY_TEXT = "querytext";
|
||||
|
||||
private static String FILTERS_QUERY = ""
|
||||
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"
|
||||
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"
|
||||
+ "PREFIX search: <https://dideside.com/searchOntology#>"
|
||||
+ "SELECT ?filterID ?fieldField ?filterLabel"
|
||||
+ "WHERE"
|
||||
+ "{ ?filterStatement rdf:type search:filter ."
|
||||
+ " ?filterStatement search:field ?fieldField ."
|
||||
+ " ?filterStatement search:id ?filterID ."
|
||||
+ " ?filterStatement rdfs:label ?filterLabel ."
|
||||
+ "} ORDER BY ?fileterLabel";
|
||||
|
||||
protected static final Map<Format,Map<Result,String>> templateTable;
|
||||
|
||||
protected enum Format {
|
||||
|
@ -217,10 +199,6 @@ public class CustomSearchController extends FreemarkerHttpServlet {
|
|||
for (SearchResultDocument doc : docs) {
|
||||
try {
|
||||
String uri = doc.getStringValue(VitroSearchTermNames.URI);
|
||||
/*
|
||||
* if(possibleExcerpts.contains(uri)) { log.info("FOUND AVAILIBLE URI " + uri);
|
||||
* }
|
||||
*/
|
||||
Individual ind = iDao.getIndividualByURI(uri);
|
||||
if (ind != null) {
|
||||
ind.setSearchSnippet(getSnippet(doc, response));
|
||||
|
@ -336,26 +314,6 @@ public class CustomSearchController extends FreemarkerHttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
private Set<String> getExistingExcerpts( VitroRequest vreq) {
|
||||
Set<String> labels = new HashSet<String>();
|
||||
try {
|
||||
//We want to get the labels for all the languages, not just the display language
|
||||
ResultSet results = QueryUtils.getLanguageNeutralQueryResults(FILTERS_QUERY, vreq);
|
||||
while (results.hasNext()) {
|
||||
QuerySolution solution = results.nextSolution();
|
||||
String nodeLiteral = solution.get("individualUri").toString();
|
||||
log.debug(nodeLiteral.toString());
|
||||
labels.add(nodeLiteral);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
return labels;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private int getHitsPerPage(VitroRequest vreq) {
|
||||
int hitsPerPage = DEFAULT_HITS_PER_PAGE;
|
||||
try{
|
||||
|
|
Loading…
Add table
Reference in a new issue