public MultiValueSortSearchModel<ProductProjection> ofStringSet(final String attributeName) { return ofString(attributeName); }
public MultiValueSortSearchModel<ProductProjection> ofStringSet(final String attributeName) { return ofString(attributeName); }
public MultiValueSortSearchModel<ProductProjection> ofStringSet(final String attributeName) { return ofString(attributeName); }
@Test public void onTextAttributes() throws Exception { testProductIds(PRODUCT_MODEL.allVariants().attribute().ofString(ATTR_NAME_TEXT).asc(), ids -> assertThat(ids).containsExactly(product2.getId(), product1.getId())); }
@Test public void canAccessTextCustomAttributes() throws Exception { final String attrName = "brand"; assertThat(FACET_ATTR.ofString(attrName).allTerms().expression()).isEqualTo("variants.attributes.brand"); assertThat(FILTER_ATTR.ofString(attrName).is("Apple")).extracting(expression()).containsExactly("variants.attributes.brand:\"Apple\""); assertThat(SORT_ATTR.ofString(attrName).ascWithMaxValue().expression()).isEqualTo("variants.attributes.brand asc.max"); }
private MultiValueSortSearchModel<ProductProjection> sortModel() { return ProductProjectionSearchModel.of().sort().allVariants().attribute().ofString("size"); } }
@Test public void sortByMultipleAttributes() throws Exception { final ProductProjectionSearch singleSortedRequest = ProductProjectionSearch.ofStaged() .plusSort(productModel -> productModel.allVariants().attribute().ofString(ATTR_NAME_COLOR).asc()); final ProductProjectionSearch searchWithNameAsc = singleSortedRequest .plusSort(productModel -> productModel.name().locale(ENGLISH).asc()); testResultIds(searchWithNameAsc, resultIds -> assertThat(resultIds).containsExactly(product3.getId(), product1.getId(), product2.getId())); final ProductProjectionSearch searchWithNameDesc = singleSortedRequest .plusSort(productModel -> productModel.name().locale(ENGLISH).desc()); testResultIds(searchWithNameDesc, resultIds -> assertThat(resultIds).containsExactly(product1.getId(), product3.getId(), product2.getId())); }