Fixed: Update Apache Solr/Lucene to release 6.2.1

OFBIZ-8316

Updated Lucene from 6.2.1 to 6.5.1 and the point fields generated by Lucene are ok now for Solr component.

Thanks: Cao Pengan for the patch and Jacques, Michael for the comments and reviews.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/trunk@1794770 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shi Jinghai
2017-05-10 23:58:31 +00:00
parent 232bf736f3
commit 37d7c585fc
5 changed files with 25 additions and 22 deletions
@@ -87,13 +87,13 @@ public class ProductDocument implements LuceneDocument {
this.addTextFieldByWeight(doc, "description", product.getString("description"), "index.weight.Product.description", 0, false, "fullText", delegator);
this.addTextFieldByWeight(doc, "longDescription", product.getString("longDescription"), "index.weight.Product.longDescription", 0, false, "fullText", delegator);
// OFBiz-8316, the LongPoint should be reused when updating to Solr 6.4.1 or later
doc.add(new StringField("introductionDate", String.valueOf(quantizeTimestampToDays(product.getTimestamp("introductionDate"))), Field.Store.NO));
// doc.add(new LongPoint("introductionDate", quantizeTimestampToDays(product.getTimestamp("introductionDate"))));
// doc.add(new StringField("introductionDate", String.valueOf(quantizeTimestampToDays(product.getTimestamp("introductionDate"))), Field.Store.NO));
doc.add(new LongPoint("introductionDate", quantizeTimestampToDays(product.getTimestamp("introductionDate"))));
nextReIndex = this.checkSetNextReIndex(product.getTimestamp("introductionDate"), nextReIndex);
// OFBiz-8316, the LongPoint should be reused when updating to Solr 6.4.1 or later
// doc.add(new LongField("salesDiscontinuationDate", quantizeTimestampToDays(product.getTimestamp("salesDiscontinuationDate")), Field.Store.NO));
doc.add(new StringField("salesDiscontinuationDate", String.valueOf(quantizeTimestampToDays(product.getTimestamp("salesDiscontinuationDate"))), Field.Store.NO));
// doc.add(new LongPoint("salesDiscontinuationDate", quantizeTimestampToDays(product.getTimestamp("salesDiscontinuationDate"))));
// doc.add(new StringField("salesDiscontinuationDate", String.valueOf(quantizeTimestampToDays(product.getTimestamp("salesDiscontinuationDate"))), Field.Store.NO));
doc.add(new LongPoint("salesDiscontinuationDate", quantizeTimestampToDays(product.getTimestamp("salesDiscontinuationDate"))));
nextReIndex = this.checkSetNextReIndex(product.getTimestamp("salesDiscontinuationDate"), nextReIndex);
doc.add(new StringField("isVariant", product.get("isVariant") != null && product.getBoolean("isVariant") ? "true" : "false", Field.Store.NO));
@@ -252,8 +252,8 @@ public class ProductDocument implements LuceneDocument {
fieldNameSb.append("_price");
// OFBiz-8316, the DoublePoint should be reused when updating to Solr 6.4.1 or later
// doc.add(new DoubleField(fieldNameSb.toString(), productPrice.getDouble("price"), Field.Store.NO));
doc.add(new StringField(fieldNameSb.toString(), String.valueOf(productPrice.getDouble("price")), Field.Store.NO));
// doc.add(new DoublePoint(fieldNameSb.toString(), productPrice.getDouble("price")));
// doc.add(new StringField(fieldNameSb.toString(), String.valueOf(productPrice.getDouble("price")), Field.Store.NO));
doc.add(new DoublePoint(fieldNameSb.toString(), productPrice.getDouble("price")));
}
// Index ProductSuppliers
@@ -41,7 +41,7 @@ public final class SearchWorker {
public static final String module = SearchWorker.class.getName();
private static final Version LUCENE_VERSION = Version.LUCENE_6_2_1;
private static final Version LUCENE_VERSION = Version.LUCENE_6_5_1;
private SearchWorker() {}
@@ -68,7 +68,7 @@ public final class SearchWorker {
public static String getIndexPath(String path) {
String basePath = UtilProperties.getPropertyValue("lucene", "defaultIndex", "index");
return (UtilValidate.isNotEmpty(path)? basePath + "/" + path: basePath);
return (UtilValidate.isNotEmpty(path)? basePath + "/" + path + "/index" : basePath);
}
public static void indexContentList(LocalDispatcher dispatcher, Delegator delegator, List<String> idList) throws Exception {