svn commit: r996057 - /ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r996057 - /ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy

lektran
Author: lektran
Date: Sat Sep 11 03:34:09 2010
New Revision: 996057

URL: http://svn.apache.org/viewvc?rev=996057&view=rev
Log:
Content search execution code was incorrectly located within an if block, preventing the search from executing if no features were selected.  Resolves OFBIZ-3927

Modified:
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy?rev=996057&r1=996056&r2=996057&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy Sat Sep 11 03:34:09 2010
@@ -64,6 +64,7 @@ try {
 } catch (java.io.FileNotFoundException e) {
     request.setAttribute("errorMsgReq", "No index file exists.");
     Debug.logError("in search, error:" + e.getMessage(), "");
+    return;
 }
 
 if (queryLine || siteId) {
@@ -117,23 +118,23 @@ if (searchFeature1 || searchFeature2 ||
         }
         combQuery.add(featureQuery, featuresRequired);
     }
-
-    if (searcher) {
-        Debug.logInfo("in search searchFeature3, combQuery:" + combQuery.toString(), "");
-        Hits hits = searcher.search(combQuery);
-        Debug.logInfo("in search, hits:" + hits.length(), "");
-
-        contentList = [] as ArrayList;
-        hitSet = [:] as HashSet;
-        for (int start = 0; start < hits.length(); start++) {
-             doc = hits.doc(start);
-             contentId = doc.contentId;
-             content = delegator.findOne("Content", [contentId : contentId], true);
-             if (!hitSet.contains(contentId)) {
-                 contentList.add(content);
-                 hitSet.add(contentId);
-             }
-        }
-        context.queryResults = contentList;
+}
+if (searcher) {
+    Debug.logInfo("in search searchFeature3, combQuery:" + combQuery.toString(), "");
+    Hits hits = searcher.search(combQuery);
+    Debug.logInfo("in search, hits:" + hits.length(), "");
+
+    contentList = [] as ArrayList;
+    hitSet = [:] as HashSet;
+    for (int start = 0; start < hits.length(); start++) {
+         doc = hits.doc(start);
+         contentId = doc.contentId;
+         content = delegator.findOne("Content", [contentId : contentId], true);
+         if (!hitSet.contains(contentId)) {
+             contentList.add(content);
+             hitSet.add(contentId);
+         }
     }
+    context.queryResults = contentList;
 }
+