Author: jleroux
Date: Thu Dec  9 08:30:16 2010
New Revision: 1043861

URL: http://svn.apache.org/viewvc?rev=1043861&view=rev
Log:
A patch from Atul Vani "There are issues with search in eCommerce" 
(https://issues.apache.org/jira/browse/OFBIZ-4032) - OFBIZ-4032

This patch was created for OFBIZ-3789 but worked for me as well on this issues

Try gz-1000 or "gift card" and follow Atul's comment below. I guess it's also 
an issue for R10.04 (I did not try) R9.04 seems OK. Note that I got no problems 
with Derby, only with Postgres.

Try searching 'gift card' from 
http://localhost:8080/ecommerce/control/advancedsearch and using some other 
value for 'Sorted by' instead of 'Keyword Relevancy'.

The first time i observed this issue KeywordSort was not working for search 
keyword 'gift' (the console log suggested that SELECT got no 'totalRelevancy' 
column but the GROUPBY has it in the query) although the KeywordSort was 
working well for 'gift card'. 

All other sorting methods from 
http://localhost:8080/ecommerce/control/advancedsearch were working for 'gift' 
but not 'gift card'.

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=1043861&r1=1043860&r2=1043861&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
 Thu Dec  9 08:30:16 2010
@@ -315,8 +315,6 @@ public class ProductSearch {
                     }
                     
entityConditionList.add(EntityCondition.makeCondition(keywordOrList, 
EntityOperator.OR));
 
-                    productIdGroupBy = true;
-
                     if (doingBothAndOr) {
                         relevancyComplexAlias.addComplexAliasMember(new 
ComplexAliasField(entityAlias, "relevancyWeight", null, "sum"));
                     } else {
@@ -1950,6 +1948,8 @@ public class ProductSearch {
                 // 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.productIdGroupBy = true;
             }
         }
 


Reply via email to