svn commit: r1802365 - /ofbiz/ofbiz-plugins/trunk/lucene/groovyScripts/content/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: r1802365 - /ofbiz/ofbiz-plugins/trunk/lucene/groovyScripts/content/Search.groovy

Deepak Dixit-5
Author: deepak
Date: Wed Jul 19 08:18:52 2017
New Revision: 1802365

URL: http://svn.apache.org/viewvc?rev=1802365&view=rev
Log:
Fixed: Added reverted changed at r#1794770 related to lucene upgrade.(OFBIZ-9301)
Thanks Renuka for reporting the issue.

Modified:
    ofbiz/ofbiz-plugins/trunk/lucene/groovyScripts/content/Search.groovy

Modified: ofbiz/ofbiz-plugins/trunk/lucene/groovyScripts/content/Search.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/lucene/groovyScripts/content/Search.groovy?rev=1802365&r1=1802364&r2=1802365&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/lucene/groovyScripts/content/Search.groovy (original)
+++ ofbiz/ofbiz-plugins/trunk/lucene/groovyScripts/content/Search.groovy Wed Jul 19 08:18:52 2017
@@ -39,7 +39,7 @@ searchFeature3 = (String) parameters.SEA
 
 featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(UtilHttp.getParameterMap(request))
 
-combQuery = new BooleanQuery()
+combQuery = new BooleanQuery.Builder()
 
 try {
     DirectoryReader reader = DirectoryReader.open(FSDirectory.open(new File(SearchWorker.getIndexPath("content")).toPath()))
@@ -64,7 +64,7 @@ if (queryLine || siteId) {
 }
 
 if (searchFeature1 || searchFeature2 || searchFeature3 || !featureIdByType.isEmpty()) {
-    featureQuery = new BooleanQuery()
+    featureQuery = new BooleanQuery.Builder()
     featuresRequired = BooleanClause.Occur.MUST
     if ("any".equals(parameters.any_or_all)) {
         featuresRequired = BooleanClause.Occur.SHOULD
@@ -90,12 +90,12 @@ if (searchFeature1 || searchFeature2 ||
             termQuery = new TermQuery(new Term("feature", value))
             featureQuery.add(termQuery, featuresRequired)
         }
-    combQuery.add(featureQuery, featuresRequired)
+    combQuery.add(featureQuery.build(), featuresRequired)
     }
 }
 if (searcher) {
     TopScoreDocCollector collector = TopScoreDocCollector.create(100) //defaulting to 100 results
-    searcher.search(combQuery, collector)
+    searcher.search(combQuery.build(), collector)
     ScoreDoc[] hits = collector.topDocs().scoreDocs
 
     contentList = [] as ArrayList