Codota Logo
FilteredFacetResult
Code IndexAdd Codota to your IDE (free)

How to use
FilteredFacetResult
in
io.sphere.sdk.search

Best Java code snippets using io.sphere.sdk.search.FilteredFacetResult (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: io.sphere.sdk.jvm/common

  public static FilteredFacetResult of(final long count) {
    return new FilteredFacetResult(count);
  }
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void parsesFilteredFacetResults() throws Exception {
  final FilteredFacetResult filteredFacet = searchResult.getFilteredFacetResult(FILTERED_FACET_KEY);
  assertThat(filteredFacet.getCount()).isEqualTo(2);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void parsesFilteredFacetResultsWithProductCounts() throws Exception {
  final FilteredFacetResult filteredFacet = searchResult.getFilteredFacetResult(FILTERED_FACET_COUNTING_PRODUCTS_KEY);
  assertThat(filteredFacet.getProductCount()).isEqualTo(1);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void filteredFacetsSupportsAlias() throws Exception {
  final String alias = "my-facet";
  final FilteredFacetExpression<ProductProjection> facetExpr = PRODUCT_MODEL.allVariants().attribute().ofString(ATTR_NAME_COLOR).withAlias(alias).onlyTerm("blue");
  final ProductProjectionSearch search = ProductProjectionSearch.ofStaged().plusFacets(facetExpr);
  testResult(search, result -> {
    assertThat(facetExpr.resultPath()).isEqualTo(alias);
    assertThat(result.getFacetResult(facetExpr).getCount()).isEqualTo(2);
  });
}
origin: commercetools/commercetools-jvm-sdk

  public static FilteredFacetResult of(final Long count, final Long productCount) {
    return new FilteredFacetResult(count, productCount);
  }
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void filteredFacetsAreParsed() throws Exception {
  final FilteredFacetExpression<ProductProjection> facetExpr = PRODUCT_MODEL.allVariants().attribute().ofString(ATTR_NAME_COLOR).onlyTerm("blue");
  final ProductProjectionSearch search = ProductProjectionSearch.ofStaged().plusFacets(facetExpr);
  testResult(search, result -> {
    final FilteredFacetResult filteredFacetResult = result.getFacetResult(facetExpr);
    assertThat(filteredFacetResult.getCount()).isEqualTo(2);
  });
}
origin: commercetools/commercetools-jvm-sdk

public static FilteredFacetResult of(final Long count) {
  return new FilteredFacetResult(count, null);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void termFacetsSupportsAlias() throws Exception {
  final String allFacetAlias = "my-facet";
  final String blueFacetAlias = "my-blue-facet";
  final TermFacetExpression<ProductProjection> allFacetExpr = PRODUCT_MODEL.allVariants().attribute().ofString(ATTR_NAME_COLOR).withAlias(allFacetAlias).allTerms();
  final FilteredFacetExpression<ProductProjection> blueFacetExpr = PRODUCT_MODEL.allVariants().attribute().ofString(ATTR_NAME_COLOR).withAlias(blueFacetAlias).onlyTerm("blue");
  final ProductProjectionSearch search = ProductProjectionSearch.ofStaged()
      .plusFacets(allFacetExpr)
      .plusFacets(blueFacetExpr);
  testResult(search, result -> {
    final TermFacetResult allFacetResult = result.getFacetResult(allFacetExpr);
    final FilteredFacetResult blueFacetResult = result.getFilteredFacetResult(blueFacetAlias);
    assertThat(allFacetExpr.resultPath()).isEqualTo(allFacetAlias);
    assertThat(blueFacetExpr.resultPath()).isEqualTo(blueFacetAlias);
    assertThat(allFacetResult.getTerms()).isEqualTo(asList(TermStats.of("blue", 2L), TermStats.of("red", 1L)));
    assertThat(blueFacetResult.getCount()).isEqualTo(2);
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void facet() {
  final List<String> categoryIds1 = getCategoryIds("A", "B-1", "C-2-2");
  final List<String> categoryIds2 = getCategoryIds("A", "B-2-3");
  final List<String> categoryIds3 = getCategoryIds("B", "C");
  withProductInCategories(client(),  categoryIds1, (Product product1) -> {
    withProductInCategories(client(), categoryIds2, (Product product2) -> {
      withProductInCategories(client(), categoryIds3, (Product product3) -> {
        assertEventually(() -> {
          final ProductProjectionSearch request = ProductProjectionSearch.ofStaged()
              .plusFacets(m -> m.categories().id().withAlias("productsInA").onlyTermSubtree(getCategoryIds("A")))
              .plusFacets(m -> m.categories().id().withAlias("productsInB").onlyTermSubtree(getCategoryIds("B")))
              .plusFacets(m -> m.categories().id().withAlias("productsInAorB").onlyTermSubtree(getCategoryIds("A", "B")))
              .plusFacets(m -> m.categories().id().withAlias("productsInC2").onlyTermSubtree(getCategoryIds("C-2")))
              .plusQueryFilters(m -> m.id().isIn(asList(product1.getId(), product2.getId(), product3.getId())));
          final PagedSearchResult<ProductProjection> pagedSearchResult = client().executeBlocking(request);
          assertThat(pagedSearchResult.getFilteredFacetResult("productsInA").getCount()).isEqualTo(2);
          assertThat(pagedSearchResult.getFilteredFacetResult("productsInB").getCount()).isEqualTo(3);
          assertThat(pagedSearchResult.getFilteredFacetResult("productsInAorB").getCount()).isEqualTo(3);
          assertThat(pagedSearchResult.getFilteredFacetResult("productsInC2").getCount()).isEqualTo(1);
        });
      });
    });
  });
}
io.sphere.sdk.searchFilteredFacetResult

Most used methods

  • <init>
  • getCount
    The number of variants matching the filter value.
  • getProductCount
    The number of products matching the filter value.

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • putExtra (Intent)
  • orElseThrow (Optional)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now