Foren

unable to sort on displayDate

thumbnail
Paresh Navalakha, geändert vor 12 Jahren.

unable to sort on displayDate

New Member Beiträge: 5 Beitrittsdatum: 04.06.10 Neueste Beiträge
Hi

I am customizing webcontent search portlet to search for articles using keywords
such that it can search for title/content/author and display folloing 3 columns in results
Title , Author , Display Date
this works.
I am able to sort on Title column asc/desc using following piece of code that i put in journal_content_search/rsearch.jsp

However I am unable to sort on "Display Date" Column.
see the below code . I am using DocumentComparator that works fine for Title sorting but fails for display tag

DocumentComparator orderByComparator=new DocumentComparator();;
boolean ascending = true;
if (orderByType.equals("desc")) {
ascending = false;
}

orderByComparator.addOrderBy(orderByCol,ascending);
and then
Hits results = indexer.search(searchContext);
List resultList=results.toList();
resultList = ListUtil.sort(resultList, orderByComparator);
why it doesn't work for display date column when looking at DocumentComparator code it looks it can sort on any column?

I also tried other option of using Sort in searchContext
Sort sort=new Sort("title", true);
Sort[] arrSort=new Sort[]{sort};
searchContext.setSorts(arrSort)
Hits results = indexer.search(searchContext);
but this didnt sort at all on any column.

Let me know if i am doing something wrong in any of the 2 methods above.
Please assist.
Thanks
thumbnail
jelmer kuperus, geändert vor 12 Jahren.

RE: unable to sort on displayDate

Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
Not all indexers store the display date. Those that do seem to store it in a field called modified not displayDate