Tabnine Logo
ProductData.getSearchKeywords
Code IndexAdd Tabnine to your IDE (free)

How to use
getSearchKeywords
method
in
io.sphere.sdk.products.ProductData

Best Java code snippets using io.sphere.sdk.products.ProductData.getSearchKeywords (Showing top 11 results out of 315)

origin: io.sphere.sdk.jvm/models

  @Override
  public SearchKeywords getSearchKeywords() {
    return productData.getSearchKeywords();
  }
}
origin: com.commercetools.sdk.jvm.core/commercetools-models

@Override
public SearchKeywords getSearchKeywords() {
  return productData.getSearchKeywords();
}
origin: io.sphere.sdk.jvm/sphere-models

@Override
public SearchKeywords getSearchKeywords() {
  return productData.getSearchKeywords();
}
origin: commercetools/commercetools-jvm-sdk

@Override
public SearchKeywords getSearchKeywords() {
  return productData.getSearchKeywords();
}
origin: commercetools/commercetools-jvm-sdk

public void setSearchKeywordsWithStaged(final Boolean staged) {
  withUpdateableProduct(client(), product -> {
    assertThat(product.getMasterData().hasStagedChanges()).isFalse();
    final SearchKeywords searchKeywords = SearchKeywords.of(Locale.ENGLISH, asList(SearchKeyword.of("Raider", CustomSuggestTokenizer.of(singletonList("Twix")))));
    final ProductUpdateCommand command = ProductUpdateCommand.of(product, SetSearchKeywords.of(searchKeywords, staged));
    final Product updatedProduct = client().executeBlocking(command);
    final SearchKeywords actualKeywords = updatedProduct.getMasterData().getStaged().getSearchKeywords();
    assertThat(actualKeywords).isEqualTo(searchKeywords);
    assertThat(updatedProduct.getMasterData().hasStagedChanges()).isEqualTo(staged);
    return updatedProduct;
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void setSearchKeywords() throws Exception {
  withUpdateableProduct(client(), product -> {
    assertThat(product.getMasterData().hasStagedChanges()).isFalse();
    final SearchKeywords searchKeywords = SearchKeywords.of(Locale.ENGLISH, asList(SearchKeyword.of("Raider", CustomSuggestTokenizer.of(singletonList("Twix")))));
    final ProductUpdateCommand command = ProductUpdateCommand.of(product, SetSearchKeywords.of(searchKeywords));
    final Product updatedProduct = client().executeBlocking(command);
    final SearchKeywords actualKeywords = updatedProduct.getMasterData().getStaged().getSearchKeywords();
    assertThat(actualKeywords).isEqualTo(searchKeywords);
    assertThat(updatedProduct.getMasterData().hasStagedChanges()).isTrue();
    return updatedProduct;
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void executionWithCustomTokenizer() {
  withSuggestProduct(client(), product -> {
    final SearchKeywords searchKeywords = SearchKeywords.of(
        Locale.ENGLISH, asList(SearchKeyword.of("Multi tool"),
            SearchKeyword.of("Swiss Army Knife", WhiteSpaceSuggestTokenizer.of())),
        Locale.GERMAN, singletonList(SearchKeyword.of("Schweizer Messer",
            CustomSuggestTokenizer.of(asList("schweizer messer", "offiziersmesser", "sackmesser"))))
    );
    assertThat(product.getMasterData().getStaged().getSearchKeywords()).isEqualTo(searchKeywords);
    final SuggestQuery suggestQuery = SuggestQuery.of(LocalizedStringEntry.of(Locale.GERMAN, "offiz"))
        .withStaged(true);
    assertEventually(() -> {
      final SuggestionResult suggestionResult = client().executeBlocking(suggestQuery);
      assertThat(suggestionResult.getSuggestionsForLocale(Locale.GERMAN))
          .matches(suggestionsList -> suggestionsList.stream()
              .anyMatch(suggestion -> suggestion.getText().equals("Schweizer Messer")));
    });
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void suggestionForMultipleLanguages() {
  withSuggestProduct(client(), product -> {
    final SearchKeywords searchKeywords = SearchKeywords.of(
        Locale.ENGLISH, asList(SearchKeyword.of("Multi tool"),
            SearchKeyword.of("Swiss Army Knife", WhiteSpaceSuggestTokenizer.of())),
        Locale.GERMAN, singletonList(SearchKeyword.of("Schweizer Messer",
            CustomSuggestTokenizer.of(asList("schweizer messer", "offiziersmesser", "sackmesser"))))
    );
    assertThat(product.getMasterData().getStaged().getSearchKeywords()).isEqualTo(searchKeywords);
    final List<LocalizedStringEntry> keywords = asList(
        LocalizedStringEntry.of(Locale.GERMAN, "offiz"),
        LocalizedStringEntry.of(Locale.ENGLISH, "multi")
    );
    final SuggestQuery suggestQuery = SuggestQuery.of(keywords)
        .withStaged(true);
    assertEventually(() -> {
      final SuggestionResult suggestionResult = client().executeBlocking(suggestQuery);
      assertThat(suggestionResult.getSuggestionsForLocale(Locale.GERMAN))
          .matches(suggestionsList -> suggestionsList.stream()
              .anyMatch(suggestion -> suggestion.getText().equals("Schweizer Messer")));
      assertThat(suggestionResult.getSuggestionsForLocale(Locale.ENGLISH))
          .matches(suggestionsList -> suggestionsList.stream()
              .anyMatch(suggestion -> suggestion.getText().equals("Multi tool")));
    });
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void execution() {
  withSuggestProduct(client(), product -> {
    final SearchKeywords searchKeywords = SearchKeywords.of(
        Locale.ENGLISH, asList(SearchKeyword.of("Multi tool"),
            SearchKeyword.of("Swiss Army Knife", WhiteSpaceSuggestTokenizer.of())),
        Locale.GERMAN, singletonList(SearchKeyword.of("Schweizer Messer",
            CustomSuggestTokenizer.of(asList("schweizer messer", "offiziersmesser", "sackmesser"))))
    );
    assertThat(product.getMasterData().getStaged().getSearchKeywords()).isEqualTo(searchKeywords);
    final SuggestQuery suggestQuery = SuggestQuery.of(LocalizedStringEntry.of(Locale.ENGLISH, "knife"))
        .withStaged(true);
    assertEventually(() -> {
      final SuggestionResult suggestionResult = client().executeBlocking(suggestQuery);
      assertThat(suggestionResult.getSuggestionsForLocale(Locale.ENGLISH))
          .matches(suggestionsList -> suggestionsList.stream()
              .anyMatch(suggestion -> suggestion.getText().equals("Swiss Army Knife")));
    });
  });
}
origin: commercetools/commercetools-jvm-sdk

  @Test
  public void fuzzy() {
    withSuggestProduct(client(), product -> {
      final SearchKeywords searchKeywords = SearchKeywords.of(
          Locale.ENGLISH, asList(SearchKeyword.of("Multi tool"),
              SearchKeyword.of("Swiss Army Knife", WhiteSpaceSuggestTokenizer.of())),
          Locale.GERMAN, singletonList(SearchKeyword.of("Schweizer Messer",
              CustomSuggestTokenizer.of(asList("schweizer messer", "offiziersmesser", "sackmesser"))))
      );
      assertThat(product.getMasterData().getStaged().getSearchKeywords()).isEqualTo(searchKeywords);

      final SuggestQuery suggestQuery = SuggestQuery.of(LocalizedStringEntry.of(Locale.ENGLISH, "knive"))
          .withStaged(true).withFuzzy(true);

      assertEventually(() -> {
        final SuggestionResult suggestionResult = client().executeBlocking(suggestQuery);

        assertThat(suggestionResult.getSuggestionsForLocale(Locale.ENGLISH))
            .matches(suggestionsList -> suggestionsList.stream()
                .anyMatch(suggestion -> suggestion.getText().equals("Swiss Army Knife")));
      });
    });
  }
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void createProductWithExternalImage() throws Exception {
  withStateByBuilder(client(), stateBuilder -> stateBuilder.initial(true).type(PRODUCT_STATE), initialProductState -> {
    final ProductType productType = ProductTypeFixtures.defaultProductType(client());
    final Image image = Image.ofWidthAndHeight("http://www.commercetools.com/assets/img/ct_logo_farbe.gif", 460, 102, "commercetools logo");
    final ProductVariantDraft masterVariant = ProductVariantDraftBuilder.of()
        .images(image)
        .build();
    final TaxCategory taxCategory = defaultTaxCategory(client());
    final SearchKeywords searchKeywords = SearchKeywords.of(Locale.ENGLISH, asList(SearchKeyword.of("foo bar baz", CustomSuggestTokenizer.of(asList("foo, baz")))));
    final ProductDraft productDraft = ProductDraftBuilder
        .of(productType, en("product with external image"), randomSlug(), masterVariant)
        .taxCategory(taxCategory)
        .searchKeywords(searchKeywords)
        .state(initialProductState)
        .build();
    final Product product = client().executeBlocking(ProductCreateCommand.of(productDraft));
    final Image loadedImage = product.getMasterData().getStaged().getMasterVariant().getImages().get(0);
    assertThat(loadedImage).isEqualTo(image);
    assertThat(product.getTaxCategory()).isEqualTo(taxCategory.toReference());
    assertThat(product.getMasterData().getStaged().getSearchKeywords()).isEqualTo(searchKeywords);
    assertThat(product.getState()).isEqualTo(initialProductState.toReference());
    //clean up test
    client().executeBlocking(ProductDeleteCommand.of(product));
  });
}
io.sphere.sdk.productsProductDatagetSearchKeywords

Popular methods of ProductData

  • getCategories
  • getDescription
  • getMasterVariant
  • getMetaDescription
  • getMetaKeywords
  • getMetaTitle
  • getName
  • getSlug
  • getVariants
  • getCategoryOrderHints
  • getAllVariants
  • getAllVariants

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now