Author: siren Date: Sun May 28 04:18:29 2006 New Revision: 409944 URL: http://svn.apache.org/viewvc?rev=409944&view=rev Log: minor refactoring
Modified: lucene/nutch/trunk/contrib/web2/plugins/web-caching-oscache/src/java/org/apache/nutch/webapp/controller/CachingSearchController.java lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/WebappInstanceServiceLocator.java lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/SearchController.java lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp Modified: lucene/nutch/trunk/contrib/web2/plugins/web-caching-oscache/src/java/org/apache/nutch/webapp/controller/CachingSearchController.java URL: http://svn.apache.org/viewvc/lucene/nutch/trunk/contrib/web2/plugins/web-caching-oscache/src/java/org/apache/nutch/webapp/controller/CachingSearchController.java?rev=409944&r1=409943&r2=409944&view=diff ============================================================================== --- lucene/nutch/trunk/contrib/web2/plugins/web-caching-oscache/src/java/org/apache/nutch/webapp/controller/CachingSearchController.java (original) +++ lucene/nutch/trunk/contrib/web2/plugins/web-caching-oscache/src/java/org/apache/nutch/webapp/controller/CachingSearchController.java Sun May 28 04:18:29 2006 @@ -25,6 +25,7 @@ import org.apache.nutch.webapp.CacheManager; import org.apache.nutch.webapp.common.Search; import org.apache.nutch.webapp.common.ServiceLocator; +import org.apache.nutch.webapp.controller.SearchController; import org.apache.struts.tiles.ComponentContext; import com.opensymphony.oscache.base.NeedsRefreshException; @@ -51,19 +52,17 @@ try { search = CacheManager.getInstance(locator.getConfiguration()) .getSearch(key); - request.setAttribute("resultInfo", search.getResultInfo()); - request.setAttribute("nutchSearch", search); - - LOG.fine("Using cached"); + request.setAttribute(Search.REQ_ATTR_SEARCH, search); + LOG.info("Using cached"); } catch (NeedsRefreshException e) { requiresUpdate = true; - LOG.fine("Cache update required"); + LOG.info("Cache update required"); } } if (key!=null && (search == null || requiresUpdate)) { - LOG.fine("Cache miss"); + LOG.info("Cache miss"); super.nutchPerform(tileContext, request, response, servletContext); - search = (Search) request.getAttribute(SearchController.REQ_ATTR_SEARCH); + search = (Search) locator.getSearch(); CacheManager.getInstance(locator.getConfiguration()).putSearch(key, search); } Modified: lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java URL: http://svn.apache.org/viewvc/lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java?rev=409944&r1=409943&r2=409944&view=diff ============================================================================== --- lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java (original) +++ lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/Search.java Sun May 28 04:18:29 2006 @@ -37,7 +37,7 @@ * */ public class Search { - + public static final String REQ_ATTR_SEARCH="nutchSearch"; public static Logger LOG = LogFormatter.getLogger(Search.class.getName()); String queryString; Modified: lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/WebappInstanceServiceLocator.java URL: http://svn.apache.org/viewvc/lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/WebappInstanceServiceLocator.java?rev=409944&r1=409943&r2=409944&view=diff ============================================================================== --- lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/WebappInstanceServiceLocator.java (original) +++ lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/common/WebappInstanceServiceLocator.java Sun May 28 04:18:29 2006 @@ -61,7 +61,7 @@ } public Search getSearch() { - String key = Search.class.getName(); + String key = Search.REQ_ATTR_SEARCH; Search search = (Search) request.getAttribute(key); if (search == null) { search = new Search(this); Modified: lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/SearchController.java URL: http://svn.apache.org/viewvc/lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/SearchController.java?rev=409944&r1=409943&r2=409944&view=diff ============================================================================== --- lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/SearchController.java (original) +++ lucene/nutch/trunk/contrib/web2/src/main/java/org/apache/nutch/webapp/controller/SearchController.java Sun May 28 04:18:29 2006 @@ -31,9 +31,6 @@ */ public class SearchController extends NutchController { - public static final String REQ_ATTR_SEARCH="nutchSearch"; - public static final String REQ_ATTR_RESULTINFO="resultInfo"; - public void nutchPerform(ComponentContext tileContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws ServletException, IOException { @@ -41,10 +38,7 @@ ServiceLocator locator=getServiceLocator(request); Search search=locator.getSearch(); - request.setAttribute(REQ_ATTR_SEARCH, search); NutchBean bean = locator.getNutchBean(); - search.performSearch(bean); - request.setAttribute(REQ_ATTR_RESULTINFO, search.getResultInfo()); } } Modified: lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp URL: http://svn.apache.org/viewvc/lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp?rev=409944&r1=409943&r2=409944&view=diff ============================================================================== --- lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp (original) +++ lucene/nutch/trunk/contrib/web2/src/main/webapp/WEB-INF/jsp/search.jsp Sun May 28 04:18:29 2006 @@ -1,25 +1,23 @@ <%@ include file="common.jsp"%> <c:choose> - <c:when test="${nutchSearch.isSearch == true}"> + <c:when test="${nutchSearch.isSearch}"> <form name="search" action="search.do" method="get"><input name="query" size="44" value="<c:out value="${nutchSearch.queryString}"/>"> <input type="submit" value="<fmt:message key="search.search"/>"> <a href="help.do"><fmt:message key="search.help" /></a></form> <c:choose> - <c:when test="${nutchSearch.hasResults == true }"> + <c:when test="${nutchSearch.hasResults}"> <fmt:message key="search.hits"> - <fmt:param value="${resultInfo[0]}" /> - <fmt:param value="${resultInfo[1]}" /> - <fmt:param value="${resultInfo[2]}" /> - <fmt:param value="${resultInfo[3]}" /> + <fmt:param value="${nutchSearch.resultInfo[0]}" /> + <fmt:param value="${nutchSearch.resultInfo[1]}" /> + <fmt:param value="${nutchSearch.resultInfo[2]}" /> + <fmt:param value="${nutchSearch.resultInfo[3]}" /> </fmt:message> <br /> <tiles:insert name="results" flush="true" /> <!-- optional tile --> - <c:if test="${cluter!=null}"> - <tiles:insert name="cluster" /> - </c:if> + <tiles:insert definition="cluster" ignore="true"/> <tiles:insert name="navigate" /> </c:when> <c:otherwise> ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _______________________________________________ Nutch-cvs mailing list Nutch-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nutch-cvs