HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Filter catalog content

Describes how to filter catalog content in Optimizely Commerce Connect 13 using Optimizely Search & Navigation.

The examples use predefined filters to narrow results on catalog content.

Markets

Filter content on current market:

var results = SearchClient.Instance.Search<VariationContent>()
    .FilterOnCurrentMarket().GetContentResult();

Filter content on market:

var result = SearchClient.Instance.Search<VariationContent>()
        .Filter(x => x.AvailableMarkets().MatchContained(v => v.Value, "market"));

Pricing

Filter content with currency:

var result = SearchClient.Instance.Search<VariationContent>()
        .Filter(x => x.DefaultPrice().UnitPrice.Currency.Match(currency));

Filter content withprice less than:

var result = SearchClient.Instance.Search<VariationContent>()
        .Filter(x => x.DefaultPrice().UnitPrice.LessThan(2));

Filter content with price greater than:

var result = SearchClient.Instance.Search<VariationContent>()
        .Filter(x => x.DefaultPrice().UnitPrice.GreaterThan(2));

Filter content with price in range:

var result = SearchClient.Instance.Search<VariationContent>()
        .Filter(x => x.DefaultPrice().UnitPrice.InRange(2, 4))

Bundles

Filter bundle entries:

var result = SearchClient.Instance.Search<BundleContent>()
        .Filter(x => x.BundleEntries().MatchContained(c => c.ID, contentReference.ID));

Filter parent bundles:

var result = SearchClient.Instance.Search<EntryContentBase>() 
    .Filter(x => x.ParentBundles().MatchContained(c => c.ID, contentReference.ID));

Packages

Filter package entries:

var result = SearchClient.Instance.Search<PackageContent>()
        .Filter(x => x.PackageEntries().MatchContained(c => c.ID, contentReference.ID));

Filter parent packages:

var result = SearchClient.Instance.Search<EntryContentBase>()
        .Filter(x => x.ParentPackages().MatchContained(c => c.ID, contentReference.ID));

Node relations

Filter parent node relations:

var result = SearchClient.Instance.Search<BundleContent>()
        .Filter(x => x.ParentNodeRelations().MatchContained(c => c.ID, contentReference.ID));

Filter child node relations:

var result = SearchClient.Instance.Search<BundleContent>()
        .Filter(x => x.ChildNodeRelations().MatchContained(c => c.ID, contentReference.ID));