Author: apatel
Date: Wed Feb 22 22:01:26 2012
New Revision: 1292534

URL: http://svn.apache.org/viewvc?rev=1292534&view=rev
Log:
[OFBIZ-4712] Merge from r1292530 from Trunk. Fix GenericModelException in 
product search when there is no valid keyword in the query string. 

Modified:
    
ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/product/ProductSearch.java

Modified: 
ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/product/ProductSearch.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/product/ProductSearch.java?rev=1292534&r1=1292533&r2=1292534&view=diff
==============================================================================
--- 
ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/product/ProductSearch.java
 (original)
+++ 
ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/product/ProductSearch.java
 Wed Feb 22 22:01:26 2012
@@ -1946,8 +1946,10 @@ public class ProductSearch {
         public void setSortOrder(ProductSearchContext productSearchContext) {
             if (productSearchContext.includedKeywordSearch) {
                 // we have to check this in order to be sure that there is a 
totalRelevancy to sort by...
-                productSearchContext.orderByList.add("-totalRelevancy");
-                productSearchContext.fieldsToSelect.add("totalRelevancy");
+                if(productSearchContext.keywordFixedOrSetAndList.size() > 0 || 
productSearchContext.andKeywordFixedSet.size() > 0) {
+                    productSearchContext.orderByList.add("-totalRelevancy");
+                    productSearchContext.fieldsToSelect.add("totalRelevancy");
+                }
                 if (productSearchContext.keywordFixedOrSetAndList.size() > 0)
                     productSearchContext.productIdGroupBy = true;
             }


Reply via email to