Search screen Pager links contain class references

Topics: Troubleshooting
Nov 4, 2011 at 4:51 PM

I know I've seen this error around before, but I can't find anything in discussions or workitems here; does anyone know what's going on or how to fix it?

The pager links are looking like this:

http://mydomain.com/Search?Count=5&Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection%5BSystem.String%2CSystem.Object%5D&Values=System.Collections.Generic.Dictionary%602%2BValueCollection%5BSystem.String%2CSystem.Object%5D

Nov 4, 2011 at 4:53 PM

Note: I have overridden the Search/Index.cshtml template in my theme. As far as I can see, nothing I've done should have changed the pager behaviour. My overridden template is as follows:

@model Orchard.Search.ViewModels.SearchViewModel
@{
    IEnumerable<object> searchResults = null;
    if (Model.ContentItems!=null) 
    {
        searchResults = Model.ContentItems;
    }
    Model.ContentItems.Classes.Add("content-items");
    Model.ContentItems.ItemClasses.Add("search-hit");
    var pages = (int)Math.Ceiling((float)Model.TotalItemCount / (float)Model.Pager.PageSize);
}
<div class="main-content search-results">
    @if (searchResults!=null) {
        if (searchResults.Count() == 0) { 
            <div class="inner-content">
                <h2>@T("No results found!")</h2>
                <p>@T("Sorry, we couldn't find anything matching that on our network. Please try another search query.")</p>
            </div>
        } else { 
            <p class="search-summary">@Display(Model.Pager) @T.Plural("1 Page","{0} Pages", pages)</p>
        }
        @Display(searchResults)
        <div class="clear"></div>
    }
</div>

Coordinator
Nov 4, 2011 at 4:56 PM

It's a bug in MV3, and it's trigger for home pages. If you look into the Pager shape in Core, you will find the hack/fix. By the way, the pager Shape has been refactored (a lot) in 1.x.