Changed a System.out to a log.debug, and removed unused code.
This commit is contained in:
parent
38902a5787
commit
c6babda169
2 changed files with 5 additions and 83 deletions
|
@ -41,7 +41,7 @@ import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneSetup;
|
||||||
import freemarker.template.Configuration;
|
import freemarker.template.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AutocompleteController is used to generate autocomplete and select element content
|
* AutocompleteController is used to generate autocomplete content
|
||||||
* through a Lucene search.
|
* through a Lucene search.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -74,14 +74,6 @@ public class AutocompleteController extends VitroAjaxController {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// make sure an IndividualDao is available
|
|
||||||
if( vreq.getWebappDaoFactory() == null
|
|
||||||
|| vreq.getWebappDaoFactory().getIndividualDao() == null ){
|
|
||||||
log.error("makeUsableBeans() could not get IndividualDao ");
|
|
||||||
doSearchError(map, config, vreq, response);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int maxHitSize = defaultMaxSearchSize;
|
int maxHitSize = defaultMaxSearchSize;
|
||||||
|
|
||||||
String qtxt = vreq.getParameter(QUERY_PARAMETER_NAME);
|
String qtxt = vreq.getParameter(QUERY_PARAMETER_NAME);
|
||||||
|
@ -156,14 +148,6 @@ public class AutocompleteController extends VitroAjaxController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private String getIndexDir(ServletContext servletContext) throws SearchException {
|
|
||||||
// Object obj = servletContext.getAttribute(LuceneSetup.INDEX_DIR);
|
|
||||||
// if( obj == null || !(obj instanceof String) )
|
|
||||||
// throw new SearchException("Could not get IndexDir for lucene index");
|
|
||||||
// else
|
|
||||||
// return (String)obj;
|
|
||||||
// }
|
|
||||||
|
|
||||||
private Analyzer getAnalyzer(ServletContext servletContext) throws SearchException {
|
private Analyzer getAnalyzer(ServletContext servletContext) throws SearchException {
|
||||||
Object obj = servletContext.getAttribute(LuceneSetup.ANALYZER);
|
Object obj = servletContext.getAttribute(LuceneSetup.ANALYZER);
|
||||||
if( obj == null || !(obj instanceof Analyzer) )
|
if( obj == null || !(obj instanceof Analyzer) )
|
||||||
|
@ -201,18 +185,6 @@ public class AutocompleteController extends VitroAjaxController {
|
||||||
query = boolQuery;
|
query = boolQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if we have a flag/portal query then we add
|
|
||||||
//it by making a BooelanQuery.
|
|
||||||
// RY 7/24/10 Temporarily commenting out for now because we're suddenly getting portal:2
|
|
||||||
// thrown onto the query. Will need to investigate post-launch of NIHVIVO 1.1.
|
|
||||||
// Query flagQuery = makeFlagQuery( portalState );
|
|
||||||
// if( flagQuery != null ){
|
|
||||||
// BooleanQuery boolQuery = new BooleanQuery();
|
|
||||||
// boolQuery.add( query, BooleanClause.Occur.MUST);
|
|
||||||
// boolQuery.add( flagQuery, BooleanClause.Occur.MUST);
|
|
||||||
// query = boolQuery;
|
|
||||||
// }
|
|
||||||
|
|
||||||
} catch (Exception ex){
|
} catch (Exception ex){
|
||||||
throw new SearchException(ex.getMessage());
|
throw new SearchException(ex.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -270,57 +242,7 @@ public class AutocompleteController extends VitroAjaxController {
|
||||||
log.warn(e, e);
|
log.warn(e, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return boolQuery;
|
return boolQuery;
|
||||||
|
|
||||||
/*
|
|
||||||
Query query = null;
|
|
||||||
|
|
||||||
// The search index is lowercased
|
|
||||||
querystr = querystr.toLowerCase();
|
|
||||||
|
|
||||||
List<String> terms = Arrays.asList(querystr.split("[, ]+"));
|
|
||||||
for (Iterator<String> i = terms.iterator(); i.hasNext(); ) {
|
|
||||||
String term = (String) i.next();
|
|
||||||
BooleanQuery boolQuery = new BooleanQuery();
|
|
||||||
// All items but last get a regular term query
|
|
||||||
if (i.hasNext()) {
|
|
||||||
boolQuery.add(
|
|
||||||
new TermQuery(new Term(termName, term)),
|
|
||||||
BooleanClause.Occur.MUST);
|
|
||||||
if (query != null) {
|
|
||||||
boolQuery.add(query, BooleanClause.Occur.MUST);
|
|
||||||
}
|
|
||||||
query = boolQuery;
|
|
||||||
}
|
|
||||||
// Last term
|
|
||||||
else {
|
|
||||||
// If the last token of the query string ends in a word-delimiting character
|
|
||||||
// it should not get a wildcard query term.
|
|
||||||
// E.g., "Dickens," should match "Dickens" but not "Dickenson"
|
|
||||||
Pattern p = Pattern.compile("\\W$");
|
|
||||||
Matcher m = p.matcher(querystr);
|
|
||||||
boolean lastTermIsWildcard = !m.find();
|
|
||||||
|
|
||||||
if (lastTermIsWildcard) {
|
|
||||||
log.debug("Adding wildcard query on last term");
|
|
||||||
boolQuery.add(
|
|
||||||
new WildcardQuery(new Term(termName, term + "*")),
|
|
||||||
BooleanClause.Occur.MUST);
|
|
||||||
} else {
|
|
||||||
log.debug("Adding term query on last term");
|
|
||||||
boolQuery.add(
|
|
||||||
new TermQuery(new Term(termName, term)),
|
|
||||||
BooleanClause.Occur.MUST);
|
|
||||||
}
|
|
||||||
if (query != null) {
|
|
||||||
boolQuery.add(query, BooleanClause.Occur.MUST);
|
|
||||||
}
|
|
||||||
query = boolQuery;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return query;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Query makeUntokenizedNameQuery(String querystr) {
|
private Query makeUntokenizedNameQuery(String querystr) {
|
||||||
|
|
|
@ -147,7 +147,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
||||||
//up an editing form.
|
//up an editing form.
|
||||||
//Note that we do not want this behavior for the delete link (handled above).
|
//Note that we do not want this behavior for the delete link (handled above).
|
||||||
if ( (predicateUri != null) && (objectUri != null) && (wdf.getObjectPropertyDao().skipEditForm(predicateUri)) ) {
|
if ( (predicateUri != null) && (objectUri != null) && (wdf.getObjectPropertyDao().skipEditForm(predicateUri)) ) {
|
||||||
System.out.println("redirecting for predicate " + predicateUri);
|
log.debug("redirecting for predicate " + predicateUri);
|
||||||
%><c:redirect url="/individual">
|
%><c:redirect url="/individual">
|
||||||
<c:param name="uri" value="${param.objectUri}"/>
|
<c:param name="uri" value="${param.objectUri}"/>
|
||||||
<c:param name="relatedSubjectUri" value="${param.subjectUri}"/>
|
<c:param name="relatedSubjectUri" value="${param.subjectUri}"/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue