Author: ssanthor
Date: 2007-01-17 11:34:19 +0100 (Wed, 17 Jan 2007)
New Revision: 4342
Modified:
trunk/site-spi/src/main/java/no/schibstedsok/searchportal/site/Site.java
trunk/war/src/main/java/no/schibstedsok/searchportal/http/servlet/SearchServlet.java
Log:
fix for SEARCH-1482
Modified:
trunk/site-spi/src/main/java/no/schibstedsok/searchportal/site/Site.java
===================================================================
--- trunk/site-spi/src/main/java/no/schibstedsok/searchportal/site/Site.java
2007-01-17 09:29:40 UTC (rev 4341)
+++ trunk/site-spi/src/main/java/no/schibstedsok/searchportal/site/Site.java
2007-01-17 10:34:19 UTC (rev 4342)
@@ -54,7 +54,8 @@
/** Name of the resource to find the PARENT_SITE_KEY property. **/
public static final String CONFIGURATION_FILE = "configuration.properties";
private static final String CORE_CONF_FILE = "core.properties";
-
+ /** Property key to find out if this Site is a sitesearch**/
+ public static final String IS_SITESEARCH_KEY = "site.issitesearch";
private static final Map<String,Site> INSTANCES = new
HashMap<String,Site>();
private static final ReentrantReadWriteLock INSTANCES_LOCK = new
ReentrantReadWriteLock();
Modified:
trunk/war/src/main/java/no/schibstedsok/searchportal/http/servlet/SearchServlet.java
===================================================================
---
trunk/war/src/main/java/no/schibstedsok/searchportal/http/servlet/SearchServlet.java
2007-01-17 09:29:40 UTC (rev 4341)
+++
trunk/war/src/main/java/no/schibstedsok/searchportal/http/servlet/SearchServlet.java
2007-01-17 10:34:19 UTC (rev 4342)
@@ -89,16 +89,7 @@
// TODO Break the method down. It is way too long for a controlling
class.
-
- if (!isEmptyQuery(request, response)) {
-
- LOG.trace("doGet()");
- LOG.debug("Character encoding =" +
request.getCharacterEncoding());
-
- final StopWatch stopWatch = new StopWatch();
- stopWatch.start();
-
- final Site site = (Site) request.getAttribute(Site.NAME_KEY);
+ final Site site = (Site) request.getAttribute(Site.NAME_KEY);
// BaseContext providing SiteContext and ResourceContext.
// We need it casted as a SiteContext for the ResourceContext
code to be happy.
final SiteContext genericCxt = new SiteContext(){
@@ -120,7 +111,16 @@
return site;
}
};
+ if (!isEmptyQuery(request, response,genericCxt)) {
+ LOG.trace("doGet()");
+ LOG.debug("Character encoding =" +
request.getCharacterEncoding());
+
+ final StopWatch stopWatch = new StopWatch();
+ stopWatch.start();
+
+
+
FactoryReloads.performReloads(genericCxt,
request.getParameter("reload"));
updateContentType(site, response, request);
@@ -200,18 +200,24 @@
private static boolean isEmptyQuery(
final HttpServletRequest request,
- final HttpServletResponse response) throws IOException{
+ final HttpServletResponse response,
+ final SiteContext ctx) throws IOException{
String redirect = null;
final String qParam = request.getParameter("q");
final String cParm = request.getParameter("c");
+ // check if this is a sitesearch
+ final Properties props = SiteConfiguration.valueOf(
+ ContextWrapper.wrap(SiteConfiguration.Context.class,
ctx)).getProperties();
+ final boolean isSitesearch =
Boolean.valueOf(props.getProperty(Site.IS_SITESEARCH_KEY)).booleanValue();
+
if (qParam == null) {
redirect = null != request.getContextPath()
? request.getContextPath()
: "/";
- }else if (null != cParm && ("d".equals(cParm) || "g".equals(cParm)) ) {
+ }else if (null != cParm && ("d".equals(cParm) || "g".equals(cParm)) &&
!isSitesearch) {
// Extra check for the Norwegian web search. Search with an empty
query string
// should return the first page.
if (qParam.trim().length() == 0) {
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits