Question

I have created a custom search results web part which implements some simple sorting, for example i have this piece of code which allows me to sort it desc/asc by title:

    CoreResultsDatasource dataSource = this.DataSource as CoreResultsDatasource;

    if (!string.IsNullOrEmpty(OrderByProperty))
    {
       // change the sortorder
       dataSource.SortOrder.Clear();
       dataSource.SortOrder.Add(OrderByProperty, SortDirection);
    }

Basically it works for the title, but when i want to sort by Modified Date, it doesnt work, i get an error in the webapart:

Property doesn't exist or is used in a manner inconsistent with schema settings.

I did try to add it in: Core Search Results Display Metadata => Properties

But still nothing happens.

Any idea how can i do it?

PS: I tried to pass "ModifiedDate" and i tried to pass "LastModifiedTime" Another strange issue i notice is that when i pass a title outside of search center it breaks i get an "Internal error" no errors in the log.

Was it helpful?

Solution

you can only provide sorting on managed properties. Look for the exact name of the managed property in central administration. I have similar web part and it works for me. Maybe look if the crawled property is correctly assigned to managed property.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top