From ade800e2d40d3e0b2c054aae6140a860434b7edc Mon Sep 17 00:00:00 2001 From: rjy7 Date: Mon, 12 Jul 2010 16:07:58 +0000 Subject: [PATCH] NIHVIVO-747 Apply client-side autocomplete filtering to add authors form --- .../controller/AutocompleteController.java | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java index 437070808..ed02057c6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java @@ -68,7 +68,6 @@ public class AutocompleteController extends FreeMarkerHttpServlet implements Sea private static final Log log = LogFactory.getLog(AutocompleteController.class); private static String QUERY_PARAMETER_NAME = "term"; - private static String EXCLUDE_URI_PARAMETER_NAME = "excludeUri"; private IndexSearcher searcher = null; String NORESULT_MSG = ""; @@ -122,16 +121,7 @@ public class AutocompleteController extends FreeMarkerHttpServlet implements Sea String qtxt = vreq.getParameter(QUERY_PARAMETER_NAME); Analyzer analyzer = getAnalyzer(getServletContext()); - // Get the list of individual uris that should be excluded from the search - String filters[] = vreq.getParameterValues(EXCLUDE_URI_PARAMETER_NAME); - List urisToExclude = null; - if (filters != null) { - urisToExclude = Arrays.asList(filters); - } - - //boolean tokenize = "true".equals(vreq.getParameter("tokenize")); - - Query query = getQuery(vreq, portalFlag, analyzer, indexDir, qtxt, urisToExclude); + Query query = getQuery(vreq, portalFlag, analyzer, indexDir, qtxt); log.debug("query for '" + qtxt +"' is " + query.toString()); if (query == null ) { @@ -215,7 +205,7 @@ public class AutocompleteController extends FreeMarkerHttpServlet implements Sea } private Query getQuery(VitroRequest request, PortalFlag portalState, - Analyzer analyzer, String indexDir, String querystr, List urisToExclude) throws SearchException{ + Analyzer analyzer, String indexDir, String querystr) throws SearchException{ Query query = null; try { @@ -243,18 +233,6 @@ public class AutocompleteController extends FreeMarkerHttpServlet implements Sea boolQuery.add(query, BooleanClause.Occur.MUST); query = boolQuery; } - - // Uris that should be excluded from the results - if (urisToExclude != null) { - for (String uri : urisToExclude) { - BooleanQuery boolQuery = new BooleanQuery(); - boolQuery.add( query, BooleanClause.Occur.MUST); - boolQuery.add( new TermQuery( - new Term(Entity2LuceneDoc.term.URI, uri)), - BooleanClause.Occur.MUST_NOT); - query = boolQuery; - } - } //if we have a flag/portal query then we add //it by making a BooelanQuery.