public final class LocalizedStringFilterSearchModel<T> extends SearchModelImpl<T> implements ExistsAndMissingFilterSearchModelSupport<T>
Modifier and Type | Method and Description |
---|---|
List<FilterExpression<T>> |
exists()
Creates filters for a field that contains at least one value.
|
TermFilterExistsAndMissingSearchModel<T,String> |
locale(Locale locale) |
List<FilterExpression<T>> |
missing()
Creates filters for fields that contain no values.
|
booleanSearchModel, dateSearchModel, datetimeSearchModel, enumFacetedSearchSearchModel, enumFacetSearchModel, enumFilterSearchModel, existsAndMissingFilterSearchModelSupport, existsFilters, getParent, getPathSegment, localizedEnumFacetedSearchSearchModel, localizedEnumFacetSearchModel, localizedEnumFilterSearchModel, localizedStringFacetedSearchSearchModel, localizedStringFacetSearchModel, localizedStringFilterSearchModel, missingFilters, moneyFacetedSearchSearchModel, moneyFacetSearchModel, moneyFilterSearchModel, numberSearchModel, referenceFacetedSearchSearchModel, referenceFacetSearchModel, referenceFilterSearchModel, searchModel, stringSearchModel, timeSearchModel
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
attributePath, buildPath, hasPath
public TermFilterExistsAndMissingSearchModel<T,String> locale(Locale locale)
public List<FilterExpression<T>> exists()
ExistsFilterSearchModelSupport
withCategory(client(), category -> { withProduct(client(), builder -> builder.categories(singleton(category.toReference())), productWithCategories -> { withProduct(client(), productWithoutCategories -> { final List<String> productIds = asList(productWithCategories.getId(), productWithoutCategories.getId()); final ProductProjectionSearch exists = ProductProjectionSearch.ofStaged() .withQueryFilters(m -> m.id().isIn(productIds))//for test isolation .plusQueryFilters(m -> m.categories().exists()); assertEventually(() -> { final List<ProductProjection> results = client().executeBlocking(exists).getResults(); assertThat(results) .hasSize(1) .extracting(s -> s.getId()) .containsExactly(productWithCategories.getId()) .doesNotContain(productWithoutCategories.getId()); }); }); }); });
See the test code.
exists
in interface ExistsAndMissingFilterSearchModelSupport<T>
exists
in interface ExistsFilterSearchModelSupport<T>
public List<FilterExpression<T>> missing()
MissingFilterSearchModelSupport
withCategory(client(), category -> { withProduct(client(), builder -> builder.categories(singleton(category.toReference())), productWithCategories -> { withProduct(client(), productWithoutCategories -> { final List<String> productIds = asList(productWithCategories.getId(), productWithoutCategories.getId()); final ProductProjectionSearch missing = ProductProjectionSearch.ofStaged() .withQueryFilters(m -> m.id().isIn(productIds))//for test isolation .plusQueryFilters(m -> m.categories().missing()); assertEventually(() -> { final List<ProductProjection> results = client().executeBlocking(missing).getResults(); assertThat(results) .hasSize(1) .extracting(s -> s.getId()) .containsExactly(productWithoutCategories.getId()) .doesNotContain(productWithCategories.getId()); }); }); }); });
See the test code.
missing
in interface ExistsAndMissingFilterSearchModelSupport<T>
missing
in interface MissingFilterSearchModelSupport<T>