1

I have a search result webpart (the same problem happens with a Search Query Webpart thay queries the same content) that looks for calendarevents later than today.

I searches through four calendars on a different application than the one that presents it.

This is the Query:

path:"http://Site/A/Lists/Kalender" OR path:"http://Site/B/Lists/Kalender" OR path:"http://Site/C/Lists/Kalender" OR path:"http://Site/D/Lists/Kalender" (IsDocument:"True" OR contentclass:"STS_ListItem") EventDate>={Today}

The Query correctly finds 6 events.

I then want to sort the by EventDate. EventDate is a Date/Time field, is queriable, searchable, retrievable, refinable and sortable and mapped to crawled property "ows_EventDate".

I've added this JSON to the sort order code in the search result webpart, so that I can easily test, whether the sorting Works:

[{"name":"Relevans","sorts":[]},{"name":"Event date","sorts":[{"p":"EventDate","d":0}]},{"name":"Date (oldest)","sorts":[{"p":"Write","d":0}]}]

When I see the results and change the sorting to "Event Date", it resorts, but doesn't do it correctly:

Result A
Eventdate: Tue Dec 15 10:30:00 UTC+0100 2015
Created: Mon Oct 26 15:28:20 UTC+0100 2015
Site/A/Lists/Kalender/DispForm.aspx?ID=4

Result 2
Eventdate: Fri Dec 4 09:00:00 UTC+0100 2015
Created: Tue Oct 13 14:37:44 UTC+0200 2015
Site/C/Lists/Kalender/DispForm.aspx?ID=1

Result 3
Eventdate: Fri Dec 11 15:00:00 UTC+0100 2015
Created: Tue Oct 13 15:55:23 UTC+0200 2015
Site/A/Lists/Kalender/DispForm.aspx?ID=3

If I create a new event, it'll end up at the top regardless of the date of the event.

2

You think that Event Date column is Date Time but it is written as Text in Managed properties and you use that property for sorting.

For sorting to work properly you need link Crawled Property ows_q_DATE_EventDate to one of predefined Date Managed Properties (Date00-Date09)

eventdate

Go to Site Settings.

  • Under Site Collection Administration click Go to top level site settings
  • Click Search Schema
  • find Date under Managed Properties and link Crawled Property ows_q_DATE_EventDate

Run full crawl.

OR

Go to those four lists and:

  • under List Setting
  • click Advanced Settings
  • and then click on Reindex Document Library.
  • After that you can run incremental crawl and this column will be picked up.

At the end you sort by that new Managed Property Date00.

And default Managed Property name of Event Date column isn't EventDate but EventDateOWSDATE

:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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