I moved the search and now it fails Umbraco 6.0.5 and uBlogsy Razor 3
Hello,
I have a requirement to redesign an existing blog and have to move the search to the home page. I moved uBlogsyWidgetSearch to run from uBlogsyGlobalNavigation, and I get a YSOD with a null reference exception on the landing.url.
Does anyone have any idea how I can make search work again please? I know the way landing is cached was changed in a later version but I don't have the luxury of upgrading.
Object reference not set to an instance of an object.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 20:
Line 21: $(window.location.href = "@landing.Url()" + '?search=' + $("#uBlogsyTxtSearch").val());
Line 22: return false;
3) I altered the GetLanding to SearchGetLanding and made it find the uBlogsyLanding whether it was starting from uBlogsySiteRoot or from a sibling node:
/// <summary> /// Gets landing node, caches result. /// </summary> /// <param name="node">A node which is a descendant, ascendant or sibling of landing.</param> /// <returns></returns> public IPublishedContent SearchGetLanding(IPublishedContent node) { string cacheKey = "GetLanding_uBlogsyLanding"; IPublishedContent landing; var cached = CacheHelper.GetFromRequestCache(cacheKey) as IPublishedContent; if (cached != null) { return cached; }
if (node.DocumentTypeAlias.ToString() == "uBlogsySiteRoot") { landing = node.DescendantsOrSelf("uBlogsyLanding").First(); return landing; } if (node.DocumentTypeAlias.ToString() == "uBlogsyPage") { bool nodeSibling = node.Sibling("uBlogsyLanding").IsFirst(); if (nodeSibling == true) {
I moved the search and now it fails Umbraco 6.0.5 and uBlogsy Razor 3
Hello,
I have a requirement to redesign an existing blog and have to move the search to the home page. I moved uBlogsyWidgetSearch to run from uBlogsyGlobalNavigation, and I get a YSOD with a null reference exception on the landing.url.
Does anyone have any idea how I can make search work again please? I know the way landing is cached was changed in a later version but I don't have the luxury of upgrading.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 20: Line 21: $(window.location.href = "@landing.Url()" + '?search=' + $("#uBlogsyTxtSearch").val()); Line 22: return false;
Ok so I fixed it myself to search from the home page or siblings, not on the blog.
1) I made a new SearchDataService.cs class and put it in the AppCode folder.
2) I copied the existing DataService.cs file and altered the following:
3) I altered the GetLanding to SearchGetLanding and made it find the uBlogsyLanding whether it was starting from uBlogsySiteRoot or from a sibling node:
I have no doubt it'll break if I add any other sections with different DocumentTypeAlias relationships but it's working for now....
is working on a reply...