private void UpdatePageScore(PageScoreNode node) { if (node.NodeInformation.TemplateId > 0) { var umbracoNode = node.NodeInformation.Node; var analysis = _analyzeService.CreateAnalysis(umbracoNode); if (analysis != null) { node.FocusKeyword = analysis.FocusKeyword; node.PageScore = analysis.Score; } } foreach (var childNode in node.Children) { UpdatePageScore(childNode); } }
public PageAnalysis AnalyzeNode(int id, string focusKeyword = null) { try { var node = _umbracoHelper.TypedContent(id); return(_analyzeService.CreateAnalysis(node, focusKeyword)); } catch (MissingFieldException ex) { var message = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(ex.Message) }; throw new HttpResponseException(message); } catch (Exception ex) { LogHelper.Error(typeof(AnalysisApiController), "RankOne AnalyzeNode Exception", ex); throw new HttpResponseException(HttpStatusCode.InternalServerError); } }
public IHttpActionResult AnalyzeNode(int id, string focusKeyword = null) { if (id < 1) { return(BadRequest()); } try { var node = _typedPublishedContentQuery.TypedContent(id); var analysis = _analyzeService.CreateAnalysis(node, focusKeyword); return(Ok(analysis)); } catch (MissingFieldException ex) { return(InternalServerError(ex)); } catch (Exception ex) { LogHelper.Error(typeof(AnalysisApiController), "RankOne AnalyzeNode Exception", ex); return(InternalServerError(ex)); } }