public interface SearchDsl<T,C extends SearchDsl<T,C>> extends ResourceSearch<T>
MAX_OFFSET, MIN_OFFSET| Modifier and Type | Method and Description |
|---|---|
C |
withFuzzy(Boolean fuzzy)
Returns an ResourceSearch with modified fuzzy parameter.
|
C |
withFuzzyLevel(Integer fuzzyLevel)
Returns an ResourceSearch with modified fuzzyLevel parameter.
|
default C |
withLimit(long limit)
Returns a new object with the new limit.
|
C |
withLimit(Long limit)
Returns a new object with the new limit.
|
default C |
withOffset(long offset)
Returns a new object with the new offset.
|
C |
withOffset(Long offset)
Returns a new object with the new offset.
|
C |
withText(Locale locale,
String text)
Returns a new object with the new text as search text.
|
C |
withText(LocalizedStringEntry text)
Returns a new object with the new text as search text.
|
endpoint, fuzzyLevel, isFuzzy, limit, offset, textdeserialize, toSearchcanDeserialize, httpRequestIntentC withText(LocalizedStringEntry text)
text - the new search text with locale, the locale should be enabled for the Project (see the project settings in the Merchant Center)textC withText(Locale locale, String text)
locale - the new locale, the locale should be enabled for the Project (see the project settings in the Merchant Center)text - the new search texttextC withFuzzy(Boolean fuzzy)
fuzzy - a flag to indicate if fuzzy search is enabled (true) or not (false)C withFuzzyLevel(Integer fuzzyLevel)
final String searchWord = "abcdfgh"; final String productName = "abcdefgh"; withProduct(client(), builder -> builder.name(ofEnglish(productName)), product -> { final ProductProjectionSearch request = ProductProjectionSearch.ofStaged() .withText(ENGLISH, searchWord) .withFuzzy(true); assertEventually(() -> { softAssert(s -> { s.assertThat(client().executeBlocking(request.withFuzzyLevel(0))) .as("level 0 matches not") .doesNotHave(product()); s.assertThat(client().executeBlocking(request.withFuzzyLevel(1))) .as("level 1 matches") .has(product()); s.assertThat(client().executeBlocking(request.withFuzzyLevel(2))) .as("level 2 matches") .has(product()); }); }); });See the test code.
fuzzyLevel - defines level of unsharpness of the search using the Damerau-Levenshtein distanceC withLimit(Long limit)
limit - the new limitlimitdefault C withLimit(long limit)
limit - the new limitlimitC withOffset(Long offset)
offset - the new offsetoffsetdefault C withOffset(long offset)
offset - the new offsetoffset