diff options
author | Chris Goldthorpe | 2010-02-02 22:34:01 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2010-02-02 22:34:01 +0000 |
commit | f192c40837d6673694d7d21461a47588f8eba8e6 (patch) | |
tree | a2d0a48c601405fd9039f5cc1c340e1c1e2578ef /org.eclipse.help.webapp | |
parent | b0120eccf49d2afe3304256233eda573389ace1f (diff) | |
download | eclipse.platform.ua-f192c40837d6673694d7d21461a47588f8eba8e6.tar.gz eclipse.platform.ua-f192c40837d6673694d7d21461a47588f8eba8e6.tar.xz eclipse.platform.ua-f192c40837d6673694d7d21461a47588f8eba8e6.zip |
Bug 288233 [Help][Search] QueryTooComplexException when searching for "*" in help
Diffstat (limited to 'org.eclipse.help.webapp')
-rw-r--r-- | org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java index 10113bd96..ddd249756 100644 --- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java +++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,6 +26,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.help.internal.base.BaseHelpSystem; import org.eclipse.help.internal.search.ISearchHitCollector; import org.eclipse.help.internal.search.ISearchQuery; +import org.eclipse.help.internal.search.QueryTooComplexException; import org.eclipse.help.internal.search.SearchHit; import org.eclipse.help.internal.search.SearchQuery; import org.eclipse.help.internal.util.URLCoder; @@ -42,12 +43,18 @@ public class SearchServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static final String PARAMETER_PHRASE = "phrase"; //$NON-NLS-1$ private Collection results = new ArrayList(); + private QueryTooComplexException searchException; private ISearchHitCollector collector = new ISearchHitCollector() { public void addHits(List hits, String wordsSearched) { if (results != null) { results.addAll(hits); } } + + public void addQTCException(QueryTooComplexException exception) + throws QueryTooComplexException { + searchException = exception; + } }; protected void doGet(HttpServletRequest req, HttpServletResponse resp) @@ -62,12 +69,14 @@ public class SearchServlet extends HttpServlet { ISearchQuery query = new SearchQuery(phrase, false, Collections.EMPTY_LIST, locale); results.clear(); BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor()); - String response = serialize(results); - resp.getWriter().write(response); - } - else { - resp.sendError(400); // bad request; missing parameter + if (searchException == null) { + String response = serialize(results); + resp.getWriter().write(response); + } } + + resp.sendError(400); // bad request; missing parameter + } public static String serialize(Collection results) { |