Browse Source

建立索引判断条件更改

dongbw 9 years ago
parent
commit
48a309e394

+ 16 - 13
search-console-b2b/src/main/java/com/uas/search/console/b2b/util/ObjectToDocumentUtils.java

@@ -915,7 +915,6 @@ public class ObjectToDocumentUtils {
 	 */
 	public static Document toDocument(PurcProofingapprovalSimpleInfo purcProofingapproval) {
 		if (purcProofingapproval == null || purcProofingapproval.getId() == null
-				|| purcProofingapproval.getPscode() == null
 				|| purcProofingapproval.getVend() == null || purcProofingapproval.getVend().getUu() == null
 				|| StringUtils.isEmpty(purcProofingapproval.getVend().getEnName())
 				|| purcProofingapproval.getEnterprise() == null || purcProofingapproval.getEnterprise().getUu() == null
@@ -953,9 +952,11 @@ public class ObjectToDocumentUtils {
 					ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.PRODSPEC_FIELD),
 					purcProofingapproval.getProdSpec(), Store.YES));
 		}
-		document.add(new TextField(
-				ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.PSCODE_FIELD),
-				purcProofingapproval.getPscode(), Store.YES));
+		if (purcProofingapproval.getPscode() != null) {
+			document.add(new TextField(
+					ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.PSCODE_FIELD),
+					purcProofingapproval.getPscode(), Store.YES));
+		}
 		if (purcProofingapproval.getSscode() != null) {
 			document.add(new TextField(
 					ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.SSCODE_FIELD),
@@ -978,9 +979,7 @@ public class ObjectToDocumentUtils {
 	 * @return
 	 */
 	public static Document toDocument(PurcProofingsendSimpleInfo purcProofingsend) {
-		if (purcProofingsend == null || purcProofingsend.getId() == null
-				|| StringUtils.isEmpty(purcProofingsend.getBrand())
-				|| StringUtils.isEmpty(purcProofingsend.getCode())) {
+		if (purcProofingsend == null || purcProofingsend.getId() == null) {
 			return null;
 		}
 		Table_name tableName = ClassAndTableNameUtils.toTableName(PurcProofingsendSimpleInfo.class);
@@ -990,17 +989,21 @@ public class ObjectToDocumentUtils {
 		document.add(
 				new StringField(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.ID_FIELD),
 						String.valueOf(purcProofingsend.getId()), Store.YES));
-		document.add(
-				new TextField(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.BRAND_FIELD),
-						purcProofingsend.getBrand(), Store.YES));
+		if (!StringUtils.isEmpty(purcProofingsend.getBrand())) {
+			document.add(new TextField(
+					ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.BRAND_FIELD),
+					purcProofingsend.getBrand(), Store.YES));
+		}
 		if (!StringUtils.isEmpty(purcProofingsend.getDate())) {
 			document.add(
 					new LongField(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.DATE_FIELD),
 							purcProofingsend.getDate().getTime(), Store.YES));
 		}
-		document.add(
-				new TextField(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.CODE_FIELD),
-						purcProofingsend.getCode(), Store.YES));
+		if (!StringUtils.isEmpty(purcProofingsend.getCode())) {
+			document.add(
+					new TextField(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.CODE_FIELD),
+							purcProofingsend.getCode(), Store.YES));
+		}
 		// vend和orderItems以json的格式存储
 		if (purcProofingsend.getProofingItem() != null) {
 			document.add(new TextField(