From 5a165ebb607f646670913b4d14caa34909039428 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 26 Apr 2023 17:28:35 +0800 Subject: [PATCH 1/4] bump version --- visearch-android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/visearch-android/build.gradle b/visearch-android/build.gradle index e4accc7..550f317 100644 --- a/visearch-android/build.gradle +++ b/visearch-android/build.gradle @@ -5,8 +5,8 @@ plugins { def versionMajor = 2 def versionMinor = 3 -def versionPatch = 1 -version = '2.3.1' +def versionPatch = 2 +version = '2.3.2' android { compileSdkVersion 29 From 689f13c668452e2defbb59760a7cea666fec1af0 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 26 Apr 2023 17:33:48 +0800 Subject: [PATCH 2/4] add strategy_id --- .../com/visenze/visearch/android/BaseSearchParams.java | 10 ++++++++++ .../com/visenze/visearch/android/IdSearchParams.java | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/BaseSearchParams.java b/visearch-android/src/main/java/com/visenze/visearch/android/BaseSearchParams.java index af140f5..69f24de 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/BaseSearchParams.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/BaseSearchParams.java @@ -38,6 +38,8 @@ public class BaseSearchParams { private String sortBy; + private String strategyId; + /** * The default sets limit at 10 and page at 1, other basic parameters are set as null */ @@ -171,6 +173,10 @@ public BaseSearchParams setSortBy(String sortBy) { return this; } + public BaseSearchParams setStrategyId(String strategyId) { + this.strategyId = strategyId; + return this; + } /** * Get the sortBy value @@ -352,6 +358,10 @@ public Map > toMap() { putStringInMap(map, "sort_by", sortBy); } + if (strategyId != null) { + putStringInMap(map, "strategy_id", strategyId); + } + if (custom != null && custom.size() > 0) { for (String key : custom.keySet()) { putStringInMap(map, key, custom.get(key)); diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/IdSearchParams.java b/visearch-android/src/main/java/com/visenze/visearch/android/IdSearchParams.java index 0883ad4..90e4003 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/IdSearchParams.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/IdSearchParams.java @@ -116,6 +116,14 @@ public void setUseSetBasedCtl(Boolean useSetBasedCtl) { this.useSetBasedCtl = useSetBasedCtl; } + public Boolean getShowBestProductImages() { + return showBestProductImages; + } + + public void setShowBestProductImages(Boolean showBestProductImages) { + this.showBestProductImages = showBestProductImages; + } + @Override public Map > toMap() { Map > map = super.toMap(); From a65f93a3b2e11e66c889e9a4503cb4c77eda7b42 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 26 Apr 2023 17:49:01 +0800 Subject: [PATCH 3/4] add box param --- .../visenze/visearch/android/BaseSearchParams.java | 4 ++++ .../visenze/visearch/android/IdSearchParams.java | 14 ++++++++++++++ .../visearch/android/ProductSearchByIdParams.java | 14 ++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/BaseSearchParams.java b/visearch-android/src/main/java/com/visenze/visearch/android/BaseSearchParams.java index 69f24de..95e35e5 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/BaseSearchParams.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/BaseSearchParams.java @@ -323,6 +323,10 @@ public Integer getFacetsLimit() { return facetsLimit; } + public String getStrategyId() { + return strategyId; + } + public Map > toMap() { Map > map = new HashMap >(); diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/IdSearchParams.java b/visearch-android/src/main/java/com/visenze/visearch/android/IdSearchParams.java index 90e4003..d3b0ed3 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/IdSearchParams.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/IdSearchParams.java @@ -26,6 +26,8 @@ public class IdSearchParams extends SearchParams { private Boolean useSetBasedCtl; private Boolean showBestProductImages; + private List box; + public IdSearchParams() { super(); } @@ -124,6 +126,14 @@ public void setShowBestProductImages(Boolean showBestProductImages) { this.showBestProductImages = showBestProductImages; } + public List getBox() { + return box; + } + + public void setBox(List box) { + this.box = box; + } + @Override public Map > toMap() { Map > map = super.toMap(); @@ -161,6 +171,10 @@ public Map > toMap() { putStringInMap(map, "show_best_product_images", showBestProductImages.toString()); } + if (box != null && box.size() > 0) { + map.put("box" , box); + } + return map; } diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/ProductSearchByIdParams.java b/visearch-android/src/main/java/com/visenze/visearch/android/ProductSearchByIdParams.java index 4ea4c4d..123fa6e 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/ProductSearchByIdParams.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/ProductSearchByIdParams.java @@ -3,6 +3,8 @@ import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; +import java.util.List; + public class ProductSearchByIdParams extends BaseProductSearchParams { @Expose(deserialize = false, serialize = false) @@ -29,6 +31,10 @@ public class ProductSearchByIdParams extends BaseProductSearchParams { @SerializedName("show_best_product_images") private Boolean showBestProductImages; + @SerializedName("box") + @Expose(deserialize = false, serialize = false) + private List box; + public String getProductId() { return productId; } @@ -93,6 +99,14 @@ public void setShowBestProductImages(Boolean showBestProductImages) { this.showBestProductImages = showBestProductImages; } + public List getBox() { + return box; + } + + public void setBox(List box) { + this.box = box; + } + public ProductSearchByIdParams(String productId) { this.productId = productId; } From 61e146ed8cb7e3b298a8a9eb235e65b2dd27495c Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 26 Apr 2023 18:16:37 +0800 Subject: [PATCH 4/4] add group results --- doc/ProductSearch.md | 6 ++-- doc/ViSearch.md | 4 +-- .../visenze/visearch/android/ResultList.java | 11 +++++++ .../android/model/GroupProductResult.java | 30 +++++++++++++++++++ .../android/model/GroupSearchResult.java | 30 +++++++++++++++++++ .../visearch/android/model/ObjectResult.java | 11 +++++++ .../visearch/android/model/ProductObject.java | 11 +++++++ .../android/model/ProductResponse.java | 11 +++++++ .../visearch/android/model/ResponseData.java | 12 ++++++++ 9 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 visearch-android/src/main/java/com/visenze/visearch/android/model/GroupProductResult.java create mode 100644 visearch-android/src/main/java/com/visenze/visearch/android/model/GroupSearchResult.java diff --git a/doc/ProductSearch.md b/doc/ProductSearch.md index fc9f230..cda0085 100644 --- a/doc/ProductSearch.md +++ b/doc/ProductSearch.md @@ -6,7 +6,7 @@ With the release of ViSenze's Catalog system, ViSearch Android SDK will now incl - Aggregate search results on a product level instead of image level - Consistent data type in API response with Catalog’s schema -> Current stable version: 2.3.1 +> Current stable version: 2.3.2 > Minimum Android SDK Version: API 9, Android 2.3 @@ -65,12 +65,12 @@ include the dependency in your project using gradle. Please change the version t ```gradle implementation 'com.github.visenze:visenze-tracking-android:0.2.3' -implementation 'com.github.visenze:visearch-sdk-android:2.3.1' +implementation 'com.github.visenze:visearch-sdk-android:2.3.2' ``` ### 1.3 Add User Permissions -Our SDK additionally needs these user permissions to work. Add the following declarations to the `AndroidManifest.xml` file. +Our SDK additionally needs these user permissions to work. Add the following declarations to the `AndroidManifest.xml` file. Note that camera permission is optional. ```xml diff --git a/doc/ViSearch.md b/doc/ViSearch.md index f3e918e..b85b3f1 100644 --- a/doc/ViSearch.md +++ b/doc/ViSearch.md @@ -4,7 +4,7 @@ ViSearch is an API that provides accurate, reliable and scalable image search. V The ViSearch Android SDK is an open source software to provide easy integration of ViSearch Search API with your Android mobile applications. It provides three search methods based on the ViSearch Search API - pre-indexed search, color search and upload search. For source code and references, please visit the [Github Repository](https://github.com/visenze/visearch-sdk-android). ->Current stable version: 2.3.1 +>Current stable version: 2.3.2 >Minimum Android SDK Version: API 9, Android 2.3 @@ -81,7 +81,7 @@ include the dependency in your project using gradle. Please change the version t ```gradle implementation 'com.github.visenze:visenze-tracking-android:0.2.3' -implementation 'com.github.visenze:visearch-sdk-android:2.3.1' +implementation 'com.github.visenze:visearch-sdk-android:2.3.2' ``` ### 1.3 Add User Permissions diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/ResultList.java b/visearch-android/src/main/java/com/visenze/visearch/android/ResultList.java index ef24db3..db40a6e 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/ResultList.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/ResultList.java @@ -1,6 +1,7 @@ package com.visenze.visearch.android; import com.visenze.visearch.android.model.Facet; +import com.visenze.visearch.android.model.GroupSearchResult; import com.visenze.visearch.android.model.ImageResult; import com.visenze.visearch.android.model.ObjectResult; import com.visenze.visearch.android.model.ProductType; @@ -58,6 +59,8 @@ public class ResultList { private List setInfoList; + private List groupResults; + public ResultList() { imageResult = new ArrayList(); queryInfo = new HashMap(); @@ -252,4 +255,12 @@ public List getSetInfoList() { public void setSetInfoList(List setInfoList) { this.setInfoList = setInfoList; } + + public List getGroupResults() { + return groupResults; + } + + public void setGroupResults(List groupResults) { + this.groupResults = groupResults; + } } diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/model/GroupProductResult.java b/visearch-android/src/main/java/com/visenze/visearch/android/model/GroupProductResult.java new file mode 100644 index 0000000..5aade2a --- /dev/null +++ b/visearch-android/src/main/java/com/visenze/visearch/android/model/GroupProductResult.java @@ -0,0 +1,30 @@ +package com.visenze.visearch.android.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class GroupProductResult { + + @SerializedName("group_by_value") + private String groupByValue; + + @SerializedName("result") + private List products; + + public String getGroupByValue() { + return groupByValue; + } + + public void setGroupByValue(String groupByValue) { + this.groupByValue = groupByValue; + } + + public List getProducts() { + return products; + } + + public void setProducts(List products) { + this.products = products; + } +} diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/model/GroupSearchResult.java b/visearch-android/src/main/java/com/visenze/visearch/android/model/GroupSearchResult.java new file mode 100644 index 0000000..62dc37e --- /dev/null +++ b/visearch-android/src/main/java/com/visenze/visearch/android/model/GroupSearchResult.java @@ -0,0 +1,30 @@ +package com.visenze.visearch.android.model; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class GroupSearchResult { + + @SerializedName("result") + private List result; + + @SerializedName("group_by_value") + private String groupByValue; + + public List getResult() { + return result; + } + + public void setResult(List result) { + this.result = result; + } + + public String getGroupByValue() { + return groupByValue; + } + + public void setGroupByValue(String groupByValue) { + this.groupByValue = groupByValue; + } +} diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/model/ObjectResult.java b/visearch-android/src/main/java/com/visenze/visearch/android/model/ObjectResult.java index 1b3b177..3c6afdd 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/model/ObjectResult.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/model/ObjectResult.java @@ -26,6 +26,9 @@ public class ObjectResult extends ProductType { @SerializedName("facets") private List facets; + @SerializedName("group_results") + private List groupResults; + public List getResult() { return result; } @@ -81,4 +84,12 @@ public List getFacets() { public void setFacets(List facets) { this.facets = facets; } + + public List getGroupResults() { + return groupResults; + } + + public void setGroupResults(List groupResults) { + this.groupResults = groupResults; + } } diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/model/ProductObject.java b/visearch-android/src/main/java/com/visenze/visearch/android/model/ProductObject.java index cb076f4..f58bae0 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/model/ProductObject.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/model/ProductObject.java @@ -8,6 +8,9 @@ public class ProductObject extends ProductType { @SerializedName("result") private List result; + @SerializedName("group_results") + private List groupResults; + @SerializedName("total") private Integer total; @@ -81,4 +84,12 @@ public List getFacets() { public void setFacets(List facets) { this.facets = facets; } + + public List getGroupResults() { + return groupResults; + } + + public void setGroupResults(List groupResults) { + this.groupResults = groupResults; + } } diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/model/ProductResponse.java b/visearch-android/src/main/java/com/visenze/visearch/android/model/ProductResponse.java index f68e50d..7178ea3 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/model/ProductResponse.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/model/ProductResponse.java @@ -25,6 +25,9 @@ public class ProductResponse { @SerializedName("result") private List products; + @SerializedName("group_results") + private List groupResults; + @SerializedName("objects") private List objects; @@ -212,4 +215,12 @@ public List getSetInfoList() { public void setSetInfoList(List setInfoList) { this.setInfoList = setInfoList; } + + public List getGroupResults() { + return groupResults; + } + + public void setGroupResults(List groupResults) { + this.groupResults = groupResults; + } } diff --git a/visearch-android/src/main/java/com/visenze/visearch/android/model/ResponseData.java b/visearch-android/src/main/java/com/visenze/visearch/android/model/ResponseData.java index 9e26d2f..616e670 100644 --- a/visearch-android/src/main/java/com/visenze/visearch/android/model/ResponseData.java +++ b/visearch-android/src/main/java/com/visenze/visearch/android/model/ResponseData.java @@ -53,6 +53,9 @@ public class ResponseData { @SerializedName("result") private List results; + @SerializedName("group_results") + private List groupResults; + @SerializedName("product_types") private List productTypes; @@ -212,6 +215,14 @@ public List getExcludedImNames() { return excludedImNames; } + public List getGroupResults() { + return groupResults; + } + + public void setGroupResults(List groupResults) { + this.groupResults = groupResults; + } + public ResultList getResultList() { ResultList resultList = new ResultList(); if(error != null && error.length > 0) { @@ -238,6 +249,7 @@ public ResultList getResultList() { resultList.setFacets(facets); resultList.setExcludedImNames(excludedImNames); resultList.setSetInfoList(setInfoList); + resultList.setGroupResults(groupResults); return resultList; }