File tree Expand file tree Collapse file tree
main/java/com/indix/query
test/java/com/indix/query Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,6 +54,16 @@ public SearchQuery withCategoryId(List<Integer> categoryId) {
5454 return this ;
5555 }
5656
57+ /**
58+ * Combined with any of query/brand/category/store, limits results to products with specific attribute values
59+ */
60+ public SearchQuery withAttrFilter (String attrFilterKey , List <String > attrFilterValues ) {
61+ for (String attrValue : attrFilterValues ) {
62+ parameters .add (new BasicNameValuePair (attrFilterKey , attrValue ));
63+ }
64+ return this ;
65+ }
66+
5767 /**
5868 * Combined with end_price, limits results to products sold by at least one store at a price between start and end
5969 */
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ public void testBasicQuery() {
4141 expectedValue .add (new BasicNameValuePair ("sortBy" , "PRICE_HIGH_TO_LOW" ));
4242 expectedValue .add (new BasicNameValuePair ("facetBy" , "storeId" ));
4343 expectedValue .add (new BasicNameValuePair ("facetBy" , "brandId" ));
44+ expectedValue .add (new BasicNameValuePair ("attr.color" , "black" ));
45+ expectedValue .add (new BasicNameValuePair ("attr.color" , "red" ));
46+ expectedValue .add (new BasicNameValuePair ("attr.size" , "xs" ));
4447 expectedValue .add (new BasicNameValuePair ("pageNumber" , "5" ));
4548 expectedValue .add (new BasicNameValuePair ("pageSize" , "55" ));
4649
@@ -52,6 +55,8 @@ public void testBasicQuery() {
5255 .withSku ("sku1" )
5356 .withSortBy (SearchQuery .SortBy .PRICE_HIGH_TO_LOW )
5457 .withFacetBy (Arrays .asList ("storeId" , "brandId" ))
58+ .withAttrFilter ("attr.color" , Arrays .asList ("black" , "red" ))
59+ .withAttrFilter ("attr.size" , Arrays .asList ("xs" ))
5560 .withPageNumber (5 )
5661 .withPageSize (55 )
5762 .withCountryCode ("US" )
You can’t perform that action at this time.
0 commit comments