XPages and Me

My Journey into XPages Development

View Data Source: Sorting your full-text search results

This post is thanks to my colleague Daniel Soares.

Daniel had created a repeat control based on a view, which displays data after the user did a search by name. As is common, the result list was unsorted, even though the first column in the view is sorted.

Looking at the data properties of the panel, there is an option for a sort column:

Image 1

After setting that property with the column name, opening the XPage in the browser and executing a search, Daniel would get an error 500.

According to a post by Niklas Heidloff, sorting search results was supposedly added with release 8.5.3

So, Daniel did some more digging and came across this post in the XPages Development Forum:


Notice the post by Bob Cross at the bottom of the thread? Apparently, in order for the “Sort Column” property to work without throwing an error 500, you have to check the box “Click on column header to sort” in your view’s column property on any column that you’d like to use for that:

Image 2

That’s exactly, what solved this issue and the search result was sorted. Who would have thought?

Thank you Dan and thank you Bob Cross.


3 responses to “View Data Source: Sorting your full-text search results

  1. Stephan H. Wissel December 2, 2014 at 3:42 am

    Kind of works as designed. To be able to sort a result set, you need an index for the column you want to sort with. Checking that property makes Domino build that index. Point in case: Open the view directly and click on a sortable column. You will see the URL syntax. Now change the URL to sort by a column that doesn’t have the property set.
    The Error you get is what triggers the Error 500 in XPages (which you could capture using an error page).
    A word of caution on FTIndex and views: There is but ONE FTIndex. So when you search in a view, you actually search in the DB and the result set is compared with the view collection. Depending on the view a Db.ftsearch and sorting in a Java collection might be faster.

    • Daniel Friedrich December 2, 2014 at 5:13 am

      Hello Stephan,

      thank you for your comment. I guess, due to the fact that it isn’t apparent from the label of the property and also not from the hover-over help text that this option needs to be set on the view column, it just baffled me.

      I would have understood it, had the column we were using not been sorted. That would have made sense to me.

      Checking the box beside an option that I see primarily as a UI setting (giving users the ability to change the initial sorting of the column by clicking on the header), in order for the sort column property to work, I would have never guessed it.

      • Stephan H. Wissel December 3, 2014 at 1:39 am

        Hi Daniel,
        the architecture is not what it seems. When you sort e.g. the first 3 columns (Like color, shape, size), Notes creates a composite index that has values line red-circle-big and blue-triangle-small. You can’t search for “small” since it reads from left to right. Checking the box makes Notes add a second index (e.g. column size) then you can search for small, big etc.
        And yes, without that insight it is puzzling.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: