Codota Logo
TermFacetExpression.expression
Code IndexAdd Codota to your IDE (free)

How to use
expression
method
in
io.sphere.sdk.search.TermFacetExpression

Best Java code snippets using io.sphere.sdk.search.TermFacetExpression.expression (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void buildsTermFacetExpressionWithAlias() throws Exception {
  final TermFacetExpression<Object> facet = TermFacetExpression.of(ATTRIBUTE_PATH + AS_ALIAS);
  assertThat(facet.expression()).isEqualTo(ATTRIBUTE_PATH + AS_ALIAS);
  assertThat(facet.attributePath()).isEqualTo(ATTRIBUTE_PATH);
  assertThat(facet.value()).isNull();
  assertThat(facet.alias()).isEqualTo(ALIAS);
  assertThat(facet.resultPath()).isEqualTo(ALIAS);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void buildsTermFacetExpressionWithAlias() throws Exception {
  final TermFacetExpression<Object> facet = TermFacetSearchModel.of(ATTRIBUTE_PATH, ofString()).withAlias(ALIAS).allTerms();
  assertThat(facet.expression()).isEqualTo(ATTRIBUTE_PATH + AS_ALIAS);
  assertThat(facet.attributePath()).isEqualTo(ATTRIBUTE_PATH);
  assertThat(facet.value()).isNull();
  assertThat(facet.alias()).isEqualTo(ALIAS);
  assertThat(facet.resultPath()).isEqualTo(ALIAS);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void usesAlias() throws Exception {
  final RangeTermFacetSearchModel<ProductProjection, BigDecimal> path = FACET_ATTR.ofNumber("size");
  assertThat(path.withAlias("my-facet").allTerms().expression()).isEqualTo("variants.attributes.size as my-facet");
  assertThat(path.withAlias("my-facet").onlyTerm(valueOf(38)).expression()).isEqualTo("variants.attributes.size:38 as my-facet");
  assertThat(path.withAlias("my-facet").onlyLessThan(valueOf(38)).expression()).isEqualTo("variants.attributes.size:range(* to 38) as my-facet");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void buildsTermFacetExpression() throws Exception {
  final TermFacetExpression<Object> facet = TermFacetSearchModel.of(ATTRIBUTE_PATH, ofString()).allTerms();
  assertThat(facet.expression()).isEqualTo(ATTRIBUTE_PATH);
  assertThat(facet.attributePath()).isEqualTo(ATTRIBUTE_PATH);
  assertThat(facet.value()).isNull();
  assertThat(facet.alias()).isNull();
  assertThat(facet.resultPath()).isEqualTo(ATTRIBUTE_PATH);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessNumberCustomAttributes() throws Exception {
  final String attrName = "length";
  assertThat(FACET_ATTR.ofNumber(attrName).allTerms().expression()).isEqualTo("variants.attributes.length");
  assertThat(FILTER_ATTR.ofNumber(attrName).is(valueOf(4))).extracting(expression()).containsExactly("variants.attributes.length:4");
  assertThat(SORT_ATTR.ofNumber(attrName).descWithMinValue().expression()).isEqualTo("variants.attributes.length desc.min");
}
origin: commercetools/commercetools-jvm-sdk

@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");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canCreateDateTimeAttributeExpressions() throws Exception {
  final String attrName = "createdDate";
  assertThat(FACET_ATTR.ofDateTime(attrName).allTerms().expression()).isEqualTo("variants.attributes.createdDate");
  assertThat(FILTER_ATTR.ofDateTime(attrName).is(dateTime("2001-09-11T22:05:09.203+00:00"))).extracting(expression()).containsExactly("variants.attributes.createdDate:\"2001-09-11T22:05:09.203Z\"");
  assertThat(SORT_ATTR.ofDateTime(attrName).ascWithMaxValue().expression()).isEqualTo("variants.attributes.createdDate asc.max");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessLastModifiedAt() throws Exception {
  assertThat(FACET_MODEL.lastModifiedAt().allTerms().expression()).isEqualTo("lastModifiedAt");
  assertThat(FILTER_MODEL.lastModifiedAt().is(dateTime("2001-09-11T22:05:09.203+00:00"))).extracting(expression()).containsExactly("lastModifiedAt:\"2001-09-11T22:05:09.203Z\"");
  assertThat(SORT_MODEL.lastModifiedAt().asc().expression()).isEqualTo("lastModifiedAt asc");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canCreateDateAttributeExpressions() throws Exception {
  final String attrName = "expirationDate";
  assertThat(FACET_ATTR.ofDate(attrName).allTerms().expression()).isEqualTo("variants.attributes.expirationDate");
  assertThat(FILTER_ATTR.ofDate(attrName).is(date("2001-09-11"))).extracting(expression()).containsExactly("variants.attributes.expirationDate:\"2001-09-11\"");
  assertThat(SORT_ATTR.ofDateTime(attrName).ascWithMaxValue().expression()).isEqualTo("variants.attributes.expirationDate asc.max");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessReferenceCustomAttributes() throws Exception {
  final String attrName = "recommendedProduct";
  assertThat(FACET_ATTR.ofReference(attrName).id().allTerms().expression()).isEqualTo("variants.attributes.recommendedProduct.id");
  assertThat(FILTER_ATTR.ofReference(attrName).id().is("some-id")).extracting(expression()).containsExactly("variants.attributes.recommendedProduct.id:\"some-id\"");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessEnumLabelCustomAttributes() throws Exception {
  final String attrName = "originCountry";
  assertThat(FACET_ATTR.ofEnum(attrName).label().allTerms().expression()).isEqualTo("variants.attributes.originCountry.label");
  assertThat(FILTER_ATTR.ofEnum(attrName).label().is("Italy")).extracting(expression()).containsExactly("variants.attributes.originCountry.label:\"Italy\"");
  assertThat(SORT_ATTR.ofEnum(attrName).label().ascWithMaxValue().expression()).isEqualTo("variants.attributes.originCountry.label asc.max");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessProductType() throws Exception {
  assertThat(FACET_MODEL.productType().id().allTerms().expression()).isEqualTo("productType.id");
  assertThat(FILTER_MODEL.productType().id().is("some-id")).extracting(expression()).containsExactly("productType.id:\"some-id\"");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessLocTextCustomAttributes() throws Exception {
  final String attrName = "material";
  assertThat(FACET_ATTR.ofLocalizedString(attrName).locale(ENGLISH).allTerms().expression()).isEqualTo("variants.attributes.material.en");
  assertThat(FILTER_ATTR.ofLocalizedString(attrName).locale(ENGLISH).is("steel")).extracting(expression()).containsExactly("variants.attributes.material.en:\"steel\"");
  assertThat(SORT_ATTR.ofLocalizedString(attrName).locale(ENGLISH).descWithMinValue().expression()).isEqualTo("variants.attributes.material.en desc.min");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessEnumKeyCustomAttributes() throws Exception {
  final String attrName = "originCountry";
  assertThat(FACET_ATTR.ofEnum(attrName).key().allTerms().expression()).isEqualTo("variants.attributes.originCountry.key");
  assertThat(FILTER_ATTR.ofEnum(attrName).key().is("Italy")).extracting(expression()).containsExactly("variants.attributes.originCountry.key:\"Italy\"");
  assertThat(SORT_ATTR.ofEnum(attrName).key().descWithMinValue().expression()).isEqualTo("variants.attributes.originCountry.key desc.min");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessMoneyCentAmountCustomAttributes() throws Exception {
  final String attrName = "originalPrice";
  assertThat(FACET_ATTR.ofMoney(attrName).centAmount().allTerms().expression()).isEqualTo("variants.attributes.originalPrice.centAmount");
  assertThat(FILTER_ATTR.ofMoney(attrName).centAmount().is(1000L)).extracting(expression()).containsExactly("variants.attributes.originalPrice.centAmount:1000");
  assertThat(SORT_ATTR.ofMoney(attrName).centAmount().ascWithMaxValue().expression()).isEqualTo("variants.attributes.originalPrice.centAmount asc.max");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessLocEnumKeyCustomAttributes() throws Exception {
  final String attrName = "color";
  assertThat(FACET_ATTR.ofLocalizedEnum(attrName).key().allTerms().expression()).isEqualTo("variants.attributes.color.key");
  assertThat(FILTER_ATTR.ofLocalizedEnum(attrName).key().is("ROT")).extracting(expression()).containsExactly("variants.attributes.color.key:\"ROT\"");
  assertThat(SORT_ATTR.ofLocalizedEnum(attrName).key().descWithMinValue().expression()).isEqualTo("variants.attributes.color.key desc.min");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessScopedPriceDiscounted() throws Exception {
  assertThat(FACET_MODEL.allVariants().scopedPriceDiscounted().allTerms().expression()).isEqualTo("variants.scopedPriceDiscounted");
  assertThat(FILTER_MODEL.allVariants().scopedPriceDiscounted().is(true)).extracting(expression()).containsExactly("variants.scopedPriceDiscounted:true");
  assertThat(SORT_MODEL.allVariants().scopedPriceDiscounted().asc().expression()).isEqualTo("variants.scopedPriceDiscounted asc");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessCurrencyCustomAttributes() throws Exception {
  final String attrName = "originalPrice";
  assertThat(FACET_ATTR.ofMoney(attrName).currency().allTerms().expression()).isEqualTo("variants.attributes.originalPrice.currencyCode");
  assertThat(FILTER_ATTR.ofMoney(attrName).currency().is(currency("EUR"))).extracting(expression()).containsExactly("variants.attributes.originalPrice.currencyCode:\"EUR\"");
  assertThat(SORT_ATTR.ofMoney(attrName).currency().descWithMinValue().expression()).isEqualTo("variants.attributes.originalPrice.currencyCode desc.min");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessPriceAmount() throws Exception {
  assertThat(FACET_MODEL.allVariants().price().centAmount().allTerms().expression()).isEqualTo("variants.price.centAmount");
  assertThat(FILTER_MODEL.allVariants().price().centAmount().is(1000L)).extracting(expression()).containsExactly("variants.price.centAmount:1000");
  assertThat(SORT_MODEL.allVariants().price().descWithMinValue().expression()).isEqualTo("price desc.min");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void canAccessPriceCurrency() throws Exception {
  assertThat(FACET_MODEL.allVariants().price().currency().allTerms().expression()).isEqualTo("variants.price.currencyCode");
  assertThat(FILTER_MODEL.allVariants().price().currency().is(currency("EUR"))).extracting(expression()).containsExactly("variants.price.currencyCode:\"EUR\"");
}
io.sphere.sdk.searchTermFacetExpressionexpression

Popular methods of TermFacetExpression

  • resultPath
  • of
  • <init>
  • alias
  • attributePath
  • toSphereFacet
  • value

Popular in Java

  • Creating JSON documents from java classes using gson
  • addToBackStack (FragmentTransaction)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • runOnUiThread (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
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