Reputation: 602
var products =
this.productClient.Search<ProductSummaryModel>(s => s.From(startIndex).Size(pageSize).Query(q =>
{
QueryDescriptor<ProductSummaryModel> query = null;
if (productDetails.IsVisible.HasValue)
{
var productStatus = productDetails.IsVisible.Value
? Constants.ProductStatus.Visible
: Constants.ProductStatus.Active;
query &= query.Term(p => p.Status, productStatus.ToString());
}
else
{
query &= !q.Term(p => p.Status, Constants.ProductStatus.Deleted.ToString());
}
return query;
}));
I get the following errors.
Cannot implicitly convert type 'Nest.BaseQuery' to 'Nest.QueryDescriptor'. An explicit conversion exists (are you missing a cast?)
Cannot implicitly convert type 'Nest.BaseQuery' to 'Nest.QueryDescriptor'. An explicit conversion exists (are you missing a cast?)
Cannot convert lambda expression to type 'Nest.SearchDescriptor' because it is not a delegate type
Cannot convert lambda expression to type 'Nest.BaseQuery' because it is not a delegate type
What am I doing wrong here?
Upvotes: 2
Views: 1251
Reputation: 13536
Change this line:
QueryDescriptor<ProductSummaryModel> query = null;
to
BaseQuery query = null;
The docs are blatantly wrong here will update this ASAP!
Upvotes: 2