Renormalize

This commit is contained in:
Stephan
2018-06-29 19:52:40 +02:00
parent c1f3de7e5c
commit 7a615133ff
1616 changed files with 273322 additions and 273322 deletions

View File

@@ -1,32 +1,32 @@
using System.Collections.Generic;
using System.Linq;
using Examine;
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.PublishedCache;
namespace Umbraco.Web
{
/// <summary>
/// Extension methods for Examine
/// </summary>
public static class ExamineExtensions
{
public static IEnumerable<PublishedSearchResult> ToPublishedSearchResults(this IEnumerable<SearchResult> results, IPublishedCache cache)
{
var list = new List<PublishedSearchResult>();
foreach (var result in results.OrderByDescending(x => x.Score))
{
if (!int.TryParse(result.Id, out var intId)) continue; //invalid
var content = cache.GetById(intId);
if (content == null) continue; // skip if this doesn't exist in the cache
list.Add(new PublishedSearchResult(content, result.Score));
}
return list;
}
}
}
using System.Collections.Generic;
using System.Linq;
using Examine;
using Umbraco.Core;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.PublishedCache;
namespace Umbraco.Web
{
/// <summary>
/// Extension methods for Examine
/// </summary>
public static class ExamineExtensions
{
public static IEnumerable<PublishedSearchResult> ToPublishedSearchResults(this IEnumerable<SearchResult> results, IPublishedCache cache)
{
var list = new List<PublishedSearchResult>();
foreach (var result in results.OrderByDescending(x => x.Score))
{
if (!int.TryParse(result.Id, out var intId)) continue; //invalid
var content = cache.GetById(intId);
if (content == null) continue; // skip if this doesn't exist in the cache
list.Add(new PublishedSearchResult(content, result.Score));
}
return list;
}
}
}