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

All foods that match search criteria

var foodListResponse = foodQueryServiceClient.Search(new FoodsSearchRequest {SearchText = "Oats"});

First 10 foods that match the search criteria

var foodsSearchRequest = new FoodsSearchRequest
{
    SearchText = "Oats",
    StartIndex = 1,
    PageSize = 10
};
var foodsListResponse = foodQueryServiceClient.Search(foodsSearchRequest);

First 10 Recipes foods that match the search criteria

var foodsSearchRequest = new FoodsSearchRequest
{
    SearchText = "Oats",
    FilterByFoodTypes = new[] {FoodType.Recipe},
    StartIndex = 1,
    PageSize = 10
};
var foodsListResponse = foodQueryServiceClient.Search(foodsSearchRequest);

All user ceated Recipes that mach the search criteria

var foodsSearchRequest = new FoodsSearchRequest
{
    SearchText = "Oats",
    FilterByFoodTypes = new[] {FoodType.Recipe},
    DataSourceFilter = new [] {DataSources.UserFoods},
    StartIndex = 1,
    PageSize = 10
};
var foodsListResponse = foodQueryServiceClient.Search(foodsSearchRequest);