mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
When a search result doesn't exist, it is not displayed
- Might occur when a deleted content is searched before the index is updated (short time), eventually when the search is triggered on another server of a farm --HG-- branch : dev
This commit is contained in:
@@ -5,6 +5,7 @@ using Orchard.Search.Services;
|
||||
using Orchard.Search.ViewModels;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Search.Models;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace Orchard.Search.Controllers {
|
||||
|
@@ -12,6 +12,6 @@ if (!string.IsNullOrWhiteSpace(Model.Query)) {
|
||||
}
|
||||
}
|
||||
if (Model.PageOfResults != null && Model.PageOfResults.Count() > 0) { %>
|
||||
<%=Html.UnorderedList(Model.PageOfResults, (r, i) => Html.DisplayForItem(r.Content) , "search-results contentItems") %>
|
||||
<%=Html.UnorderedList(Model.PageOfResults.Where(hit => hit.Content != null), (r, i) => Html.DisplayForItem(r.Content), "search-results contentItems")%>
|
||||
<%=Html.Pager(Model.PageOfResults, Model.PageOfResults.PageNumber, Model.DefaultPageSize, new {q = Model.Query}) %><%
|
||||
} %>
|
@@ -385,6 +385,9 @@ namespace Orchard.ContentManagement {
|
||||
}
|
||||
|
||||
public ContentItemViewModel<TContentPart> BuildDisplayModel<TContentPart>(TContentPart content, string displayType) where TContentPart : IContent {
|
||||
if (content == null)
|
||||
return null;
|
||||
|
||||
var displayModel = new ContentItemViewModel<TContentPart>(content);
|
||||
var context = new BuildDisplayModelContext(displayModel, displayType);
|
||||
foreach (var handler in Handlers) {
|
||||
|
Reference in New Issue
Block a user