Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
    
When you are trying to sort by Modified Date, which OrderByProperty name you are passing? –  Kai Feb 20 '13 at 10:06
    
I tried: "ModifiedDate" and i tried "LastModifiedTime" –  Shkipper Feb 20 '13 at 11:00
    
Ivan is correct, you should use exact managed property name, for Modified date it is write managed property. Also, delete all none existing managed properties from Core Search Results Display Metadata => Properties to error disappear. –  Kai Feb 20 '13 at 11:54
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
Same web part? Does it work also outside of search center? And the filter works perfectly? And what peoperty exactly you use? –  Shkipper Feb 20 '13 at 12:09
    
yes it works outside of search centre. using it for showing last 5 documents by mod date. in text box for order property name i have "LastModifiedTime", in fixed query : scope:"MyDocuments". Probably look if 2 or more web parts on one page does not have the same value in 'Cross web part query id'. i had issues with this. –  Ivan Feb 20 '13 at 12:16
    
also be aware that if you are doing filtering in fixed query there are som strange restrictions and rules, look at here and here –  Ivan Feb 20 '13 at 12:31
    
Yes Ivan i think i have same webpart as you do, but when i add this LastModifiedTime, i get "Property doesn't exist or is used in a manner inconsistent with schema settings. " Although it is default property ... –  Shkipper Feb 20 '13 at 12:49
    
probably past here all the sections where you are using this property, maybe there is really just small typo –  Ivan Feb 20 '13 at 13:07
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.