From 0e265c038f9b3e6a0a20cb2714d3aa76eb1bdb46 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 10 Jan 2024 15:51:23 +0800 Subject: [PATCH 1/3] bump version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 217acd7..2d388c3 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.visenze visearch-java-sdk ViSearch Java SDK - 1.14.1 + 1.14.2 jar https://github.com/visenze/visearch-sdk-java ViSearch Java SDK From 06fd08c9887f1a651767af365402440b9f92282e Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 10 Jan 2024 16:15:47 +0800 Subject: [PATCH 2/3] add hidden categories in response --- .../visenze/productsearch/ProductSearchResponse.java | 11 +++++++++++ .../java/com/visenze/visearch/PagedSearchResult.java | 10 ++++++++++ .../visearch/internal/SearchOperationsImpl.java | 6 ++++++ .../internal/constant/ViSearchHttpConstants.java | 1 + 4 files changed, 28 insertions(+) diff --git a/src/main/java/com/visenze/productsearch/ProductSearchResponse.java b/src/main/java/com/visenze/productsearch/ProductSearchResponse.java index af6d4ca..a086d72 100644 --- a/src/main/java/com/visenze/productsearch/ProductSearchResponse.java +++ b/src/main/java/com/visenze/productsearch/ProductSearchResponse.java @@ -119,6 +119,9 @@ public class ProductSearchResponse extends BaseProductSearchResponse { @JsonProperty("excluded_pids") private List excludedPids; + @JsonProperty("hidden_categories") + private List hiddenCategories; + @JsonProperty("set_info") private List setInfoList; @@ -259,6 +262,14 @@ public void setExcludedPids(List excludedPids) { this.excludedPids = excludedPids; } + public List getHiddenCategories() { + return hiddenCategories; + } + + public void setHiddenCategories(List hiddenCategories) { + this.hiddenCategories = hiddenCategories; + } + public List getSetInfoList() { return setInfoList; } diff --git a/src/main/java/com/visenze/visearch/PagedSearchResult.java b/src/main/java/com/visenze/visearch/PagedSearchResult.java index 24df72a..13b3fe1 100644 --- a/src/main/java/com/visenze/visearch/PagedSearchResult.java +++ b/src/main/java/com/visenze/visearch/PagedSearchResult.java @@ -38,6 +38,8 @@ public class PagedSearchResult extends PagedResult { private List excludedImNames; + private List hiddenCategories; + private List setInfoList; private String reqId; @@ -175,6 +177,14 @@ public void setExcludedImNames(List excludedImNames) { this.excludedImNames = excludedImNames; } + public List getHiddenCategories() { + return hiddenCategories; + } + + public void setHiddenCategories(List hiddenCategories) { + this.hiddenCategories = hiddenCategories; + } + public List getSetInfoList() { return setInfoList; } diff --git a/src/main/java/com/visenze/visearch/internal/SearchOperationsImpl.java b/src/main/java/com/visenze/visearch/internal/SearchOperationsImpl.java index 03c3e24..cc0a0b3 100644 --- a/src/main/java/com/visenze/visearch/internal/SearchOperationsImpl.java +++ b/src/main/java/com/visenze/visearch/internal/SearchOperationsImpl.java @@ -349,6 +349,12 @@ private PagedSearchResult getPagedResult(ViSearchHttpResponse httpResponse) { result.setExcludedImNames(excludedImNames); } + JsonNode hiddenCategoriesNode = node.get(ViSearchHttpConstants.HIDDEN_CATEGORIES); + if (hiddenCategoriesNode != null) { + List hiddenCategories = deserializeListResult(response, hiddenCategoriesNode, String.class); + result.setHiddenCategories(hiddenCategories); + } + JsonNode setInfoListNode = node.get(ViSearchHttpConstants.SET_INFO); if (setInfoListNode != null) { List setInfoList = deserializeListResult(response, setInfoListNode, SetInfo.class); diff --git a/src/main/java/com/visenze/visearch/internal/constant/ViSearchHttpConstants.java b/src/main/java/com/visenze/visearch/internal/constant/ViSearchHttpConstants.java index 5973a53..9f916e4 100644 --- a/src/main/java/com/visenze/visearch/internal/constant/ViSearchHttpConstants.java +++ b/src/main/java/com/visenze/visearch/internal/constant/ViSearchHttpConstants.java @@ -119,6 +119,7 @@ public abstract class ViSearchHttpConstants { public static final String SHOW_EXCLUDED_PIDS = "show_excluded_pids"; public static final String SHOW_PINNED_PIDS = "show_pinned_pids"; public static final String EXCLUDED_IM_NAMES = "excluded_im_names"; + public static final String HIDDEN_CATEGORIES = "hidden_categories"; public static final String USE_SET_BASED_CTL = "use_set_based_ctl"; public static final String SET_LIMIT = "set_limit"; From 737f805d455c851892c1ad3dfc6ec298e7e30fa0 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 10 Jan 2024 16:27:30 +0800 Subject: [PATCH 3/3] add 2 new response fields --- .../productsearch/ProductSearchResponse.java | 11 +++++++++++ .../com/visenze/visearch/PagedSearchResult.java | 10 ++++++++++ .../visearch/internal/SearchOperationsImpl.java | 6 ++++++ .../internal/constant/ViSearchHttpConstants.java | 3 +++ .../visearch/ViSearchSearchOperationsTest.java | 13 +++++++++++++ 5 files changed, 43 insertions(+) diff --git a/src/main/java/com/visenze/productsearch/ProductSearchResponse.java b/src/main/java/com/visenze/productsearch/ProductSearchResponse.java index a086d72..2af7f15 100644 --- a/src/main/java/com/visenze/productsearch/ProductSearchResponse.java +++ b/src/main/java/com/visenze/productsearch/ProductSearchResponse.java @@ -122,6 +122,9 @@ public class ProductSearchResponse extends BaseProductSearchResponse { @JsonProperty("hidden_categories") private List hiddenCategories; + @JsonProperty("pin_category_pid_map") + private Map pinCategoryPidMap; + @JsonProperty("set_info") private List setInfoList; @@ -270,6 +273,14 @@ public void setHiddenCategories(List hiddenCategories) { this.hiddenCategories = hiddenCategories; } + public Map getPinCategoryPidMap() { + return pinCategoryPidMap; + } + + public void setPinCategoryPidMap(Map pinCategoryPidMap) { + this.pinCategoryPidMap = pinCategoryPidMap; + } + public List getSetInfoList() { return setInfoList; } diff --git a/src/main/java/com/visenze/visearch/PagedSearchResult.java b/src/main/java/com/visenze/visearch/PagedSearchResult.java index 13b3fe1..eee1544 100644 --- a/src/main/java/com/visenze/visearch/PagedSearchResult.java +++ b/src/main/java/com/visenze/visearch/PagedSearchResult.java @@ -40,6 +40,8 @@ public class PagedSearchResult extends PagedResult { private List hiddenCategories; + private Map pinCategoryPidMap; + private List setInfoList; private String reqId; @@ -185,6 +187,14 @@ public void setHiddenCategories(List hiddenCategories) { this.hiddenCategories = hiddenCategories; } + public Map getPinCategoryPidMap() { + return pinCategoryPidMap; + } + + public void setPinCategoryPidMap(Map pinCategoryPidMap) { + this.pinCategoryPidMap = pinCategoryPidMap; + } + public List getSetInfoList() { return setInfoList; } diff --git a/src/main/java/com/visenze/visearch/internal/SearchOperationsImpl.java b/src/main/java/com/visenze/visearch/internal/SearchOperationsImpl.java index cc0a0b3..11f9af0 100644 --- a/src/main/java/com/visenze/visearch/internal/SearchOperationsImpl.java +++ b/src/main/java/com/visenze/visearch/internal/SearchOperationsImpl.java @@ -355,6 +355,12 @@ private PagedSearchResult getPagedResult(ViSearchHttpResponse httpResponse) { result.setHiddenCategories(hiddenCategories); } + JsonNode pinCategoryPidMapNode = node.get(ViSearchHttpConstants.PIN_CATEGORY_PID_MAP); + if (pinCategoryPidMapNode != null) { + Map pinCategoryPidMap = deserializeMapResult(response, pinCategoryPidMapNode, String.class, String.class); + result.setPinCategoryPidMap(pinCategoryPidMap); + } + JsonNode setInfoListNode = node.get(ViSearchHttpConstants.SET_INFO); if (setInfoListNode != null) { List setInfoList = deserializeListResult(response, setInfoListNode, SetInfo.class); diff --git a/src/main/java/com/visenze/visearch/internal/constant/ViSearchHttpConstants.java b/src/main/java/com/visenze/visearch/internal/constant/ViSearchHttpConstants.java index 9f916e4..321bfee 100644 --- a/src/main/java/com/visenze/visearch/internal/constant/ViSearchHttpConstants.java +++ b/src/main/java/com/visenze/visearch/internal/constant/ViSearchHttpConstants.java @@ -120,6 +120,9 @@ public abstract class ViSearchHttpConstants { public static final String SHOW_PINNED_PIDS = "show_pinned_pids"; public static final String EXCLUDED_IM_NAMES = "excluded_im_names"; public static final String HIDDEN_CATEGORIES = "hidden_categories"; + + public static final String PIN_CATEGORY_PID_MAP = "pin_category_pid_map"; + public static final String USE_SET_BASED_CTL = "use_set_based_ctl"; public static final String SET_LIMIT = "set_limit"; diff --git a/src/test/java/com/visenze/visearch/ViSearchSearchOperationsTest.java b/src/test/java/com/visenze/visearch/ViSearchSearchOperationsTest.java index 293218e..796722d 100644 --- a/src/test/java/com/visenze/visearch/ViSearchSearchOperationsTest.java +++ b/src/test/java/com/visenze/visearch/ViSearchSearchOperationsTest.java @@ -1361,6 +1361,11 @@ public void testRecommendationResponsePinExcludedParsing() { " }\n" + " ],\n" + " \"excluded_im_names\" : [\"im1\", \"im2\"],\n" + + " \"hidden_categories\" : [\"top\", \"shoe\"],\n" + + " \"pin_category_pid_map\": {\n" + + " \"top\": \"top1\",\n" + + " \"shoe\": \"shoe2\"\n" + + " },\n" + " \"reqid\": \"1317439821672620035\"\n" + "}"; when(response.getBody()).thenReturn(responseBody); @@ -1396,6 +1401,14 @@ public void testRecommendationResponsePinExcludedParsing() { assertEquals("im1" , result.getExcludedImNames().get(0)); assertEquals("im2" , result.getExcludedImNames().get(1)); + assertEquals(2, result.getHiddenCategories().size()); + assertEquals("top" , result.getHiddenCategories().get(0)); + assertEquals("shoe" , result.getHiddenCategories().get(1)); + + assertEquals(2, result.getPinCategoryPidMap().size()); + assertEquals("top1", result.getPinCategoryPidMap().get("top")); + assertEquals("shoe2", result.getPinCategoryPidMap().get("shoe")); + }