Author: apatel
Date: Wed Feb 22 21:52:21 2012
New Revision: 1292530
URL:
http://svn.apache.org/viewvc?rev=1292530&view=revLog:
[OFBIZ-4712] fix GenericModelException in product search when there is no valid keyword in the query string.
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java?rev=1292530&r1=1292529&r2=1292530&view=diff==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java Wed Feb 22 21:52:21 2012
@@ -1974,8 +1974,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;
}