Vulnerability in EPiServer.Forms
There's an index object which is having an attribute of type List and I need to delete the index object, when that attribute contains a given value.
I tried this,
SearchClient.Instance.Delete(x => x.RelatedEntities.Contains(given_id));
But it says, "Can not convert expression type 'bool' to return type 'EPiServer.Find.Api.Quering.Filter'"
Is there a simple way to do this straight away?
Could you try to use Match extension method instead of Contains? Like this:
SearchClient.Instance.Delete<NewsFeedItem>(x => x.RelatedEntities.Match(given_id));
Thanks for the reply. Please help with this.
How can we update (instead delete) an instance of the index in the same scenario like above?
There are two ways you could update the item.The first way is to simply reindex the item:
myItem.PageName = "A new name";
or, you could update the field directly if you have the ID:
SearchClient.Instance.Update<PageData>(4).Field(x => x.PageName, "New page name").Execute();