Browse Source

改变属性值联想词返回类型

sunyj 9 years ago
parent
commit
8b76a03df2

+ 3 - 2
search-api/src/main/java/com/uas/search/service/SearchService.java

@@ -158,8 +158,9 @@ public interface SearchService {
 	 *            (可选) 属性值(部分字符)
 	 * @param topNum
 	 *            (可选) 获取的最大数目
-	 * @return 相似的属性值
+	 * @return 相似的属性值,包括propertyValue
 	 */
-	public List<String> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword, Long topNum);
+	public List<Map<String, String>> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword,
+			Long topNum);
 
 }

+ 1 - 1
search-console/src/main/java/com/uas/search/console/controller/SearchController.java

@@ -147,7 +147,7 @@ public class SearchController {
 	
 	@RequestMapping("/similarPropertyValues")
 	@ResponseBody
-	public List<String> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword, Long topNum) {
+	public List<Map<String, String>> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword, Long topNum) {
 		return searchService.getSimilarPropertyValues(kindId, propertyId, keyword, topNum);
 	}
 }

+ 9 - 2
search-console/src/main/java/com/uas/search/console/service/impl/SearchServiceImpl.java

@@ -697,7 +697,7 @@ public class SearchServiceImpl implements SearchService {
 	}
 
 	@Override
-	public List<String> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword, Long topNum) {
+	public List<Map<String, String>> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword, Long topNum) {
 		String message = "";
 		if (kindId == null || propertyId == null) {
 			message = "类目id或属性id为空";
@@ -746,7 +746,14 @@ public class SearchServiceImpl implements SearchService {
 		} catch (IOException e) {
 			e.printStackTrace();
 		}
-		return propertyValues;
+
+		List<Map<String, String>> result = new ArrayList<>();
+		for (String propertyValue : propertyValues) {
+			Map<String, String> map = new HashMap<>();
+			map.put("propertyValue", propertyValue);
+			result.add(map);
+		}
+		return result;
 
 	}