Skip to content

SearchByName

alex-caroline edited this page Nov 9, 2018 · 4 revisions

Get All Published Foods that match Pizza

var foodsListResponse = foodQueryServiceClient.SearchByName(new FoodsByNameRequest { FoodName = "Pizza" });

Get All Foods that match Pizza

var foodsByNameRequest = new FoodsByNameRequest
{
    FoodName = "Pizza",
    FilterByPublicationStates = new[] { PublicationState.Draft, PublicationState.Published }
};
var foodsListResponse = foodQueryServiceClient.SearchByName(foodsByNameRequest);

Get All Recipes that match Pizza

var foodsByNameRequest = new FoodsByNameRequest
{
    FoodName = "Pizza",
    FilterByPublicationStates = new[] { PublicationState.Draft, PublicationState.Published },
    FilterByFoodTypes = new[] { FoodType.Recipe }
};
var foodsListResponse = foodQueryServiceClient.SearchByName(foodsByNameRequest);

Get First 10 Recipes that match Pizza

var foodsByNameRequest = new FoodsByNameRequest
{
    FoodName = "Pizza",
    FilterByPublicationStates = new[] { PublicationState.Draft, PublicationState.Published },
    FilterByFoodTypes = new[] { FoodType.Recipe },
    StartIndex = 1,
    PageSize =  10
};
var foodsListResponse = foodQueryServiceClient.SearchByName(foodsByNameRequest);

Get First 10 user created Recipes that match Pizza

var foodsByNameRequest = new FoodsByNameRequest
{
    FoodName = "Pizza",
    FilterByPublicationStates = new[] { PublicationState.Draft, PublicationState.Published },
    FilterByFoodTypes = new[] { FoodType.Recipe },
    DataSourceFilter = new [] {DataSources.UserFoods},
    StartIndex = 1,
    PageSize =  10
};
var foodsListResponse = foodQueryServiceClient.SearchByName(foodsByNameRequest);