I trying to add a Content serach webpart to a page by Activation feature. But im getting wrong web part when trying i want Content serach part to be able to query content from other parts in the site collection
using (SPWeb web = siteCollection.RootWeb)
{
var file = web.GetFile(PageUrl);
var prevAllowUnsafe = web.AllowUnsafeUpdates;
web.AllowUnsafeUpdates = true;
string quey = "path"+ query ;
using (var webMngr = web.GetLimitedWebPartManager(file.Url, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared))
{
// this is wrong ..... I want Content search web part not query
ContentByQueryWebPart contentByQueryWebPart = new ContentByQueryWebPart();
contentByQueryWebPart.Title = "Test test";
contentByQueryWebPart.QueryOverride = quey;
webMngr.AddWebPart(contentByQueryWebPart, WebPartZoneId, 0);
webMngr.SaveChanges(contentByQueryWebPart);
web.Update();