You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/11/08 08:02:16 UTC

svn commit: r1199130 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/content/ applications/product/config/ applications/product/src/org/ofbiz/product/product/ framework/common/config/

Author: hansbak
Date: Tue Nov  8 07:02:16 2011
New Revision: 1199130

URL: http://svn.apache.org/viewvc?rev=1199130&view=rev
Log:
also introduce keyword size limit(configurable) in product and move property setting to content component

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java
    ofbiz/trunk/applications/product/config/prodsearch.properties
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
    ofbiz/trunk/framework/common/config/keywordsearch.properties

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java?rev=1199130&r1=1199129&r2=1199130&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java Tue Nov  8 07:02:16 2011
@@ -198,7 +198,7 @@ public class ContentKeywordIndex {
         }
 
         List<GenericValue> toBeStored = FastList.newInstance();
-        int keywordMaxLength = Integer.parseInt(UtilProperties.getPropertyValue("keywordsearch", "keyword.max.length"));
+        int keywordMaxLength = Integer.parseInt(UtilProperties.getPropertyValue("contentsearch", "content.keyword.max.length"));
         for (Map.Entry<String, Long> entry: keywords.entrySet()) {
             if (entry.getKey().length() <= keywordMaxLength) {
                 GenericValue contentKeyword = delegator.makeValue("ContentKeyword", UtilMisc.toMap("contentId", content.getString("contentId"), "keyword", entry.getKey(), "relevancyWeight", entry.getValue()));

Modified: ofbiz/trunk/applications/product/config/prodsearch.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/prodsearch.properties?rev=1199130&r1=1199129&r2=1199130&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/prodsearch.properties (original)
+++ ofbiz/trunk/applications/product/config/prodsearch.properties Tue Nov  8 07:02:16 2011
@@ -57,3 +57,6 @@ index.delete.on_index=false
 attach.feature.type.exclude=BILLING_FEATURE,GIFT_WRAP
 # if this (the include property) is empty all types will be included, if it contains anything only those types will be included
 attach.feature.type.include=
+
+# The product keyword will not create when word's length more than keyword.max.length
+product.keyword.max.length = 15

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java?rev=1199130&r1=1199129&r2=1199130&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java Tue Nov  8 07:02:16 2011
@@ -191,9 +191,12 @@ public class KeywordIndex {
         }
 
         List<GenericValue> toBeStored = FastList.newInstance();
+        int keywordMaxLength = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "product.keyword.max.length"));
         for (Map.Entry<String, Long> entry: keywords.entrySet()) {
-            GenericValue productKeyword = delegator.makeValue("ProductKeyword", UtilMisc.toMap("productId", product.getString("productId"), "keyword", entry.getKey(), "relevancyWeight", entry.getValue()));
-            toBeStored.add(productKeyword);
+            if (entry.getKey().length() <= keywordMaxLength) {
+                GenericValue productKeyword = delegator.makeValue("ProductKeyword", UtilMisc.toMap("productId", product.getString("productId"), "keyword", entry.getKey(), "relevancyWeight", entry.getValue()));
+                toBeStored.add(productKeyword);
+            }
         }
         if (toBeStored.size() > 0) {
             if (Debug.verboseOn()) Debug.logVerbose("[KeywordIndex.indexKeywords] Storing " + toBeStored.size() + " keywords for productId " + product.getString("productId"), module);

Modified: ofbiz/trunk/framework/common/config/keywordsearch.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/keywordsearch.properties?rev=1199130&r1=1199129&r2=1199130&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/keywordsearch.properties (original)
+++ ofbiz/trunk/framework/common/config/keywordsearch.properties Tue Nov  8 07:02:16 2011
@@ -34,6 +34,3 @@ stem.bag=:s:ies:y:
 
 # Characters that should be used as token separators when pulling out keywords
 index.keyword.separators=;: ,.!?\t\"\'\r\n\\/()[]{}*%<>-+_
-
-# The keyword will not create when word's length more than keyword.max.length
-keyword.max.length = 15