1
votes

My Xpage has a dataView that points to a view which is sorted by employee name. One of the other fields in the employee view is their Location. I have a combobox in the header of the view that allows a user to subset to one location. When subsetted the correct employees appear, but the sort order is lost.

I have looked at a few answers in Stack overflow such as this and this. but cannot get them to work. I think the difference is that I am not trying to filter on a value that is sorted.

Here is my code for the FT Search:

var tmpArray = new Array("");
var cTerms = 0;

//Geo Location Search
if(viewScope.key != null & viewScope.key != "" & viewScope.key != "All Locations" & viewScope.key != "--Select a Location--") {
             tmpArray[cTerms++] = "(FIELD HR_GeoLocation = " + viewScope.key + ")";}

qstring = tmpArray.join(" AND ").trim();
viewScope.queryString = qstring; // this just displays the query
return qstring // this is what sets the search property

The view's first field is the users last name, first name, descending.

1

1 Answers

1
votes

FTSearch doesn't return found documents in view's order:

The collection of documents that match the full-text query are sorted by relevance, with highest relevance first.

Use an additional view which is categorized by Location and use Location as key in

  • Filter by category name (categoryFilter) or
  • Filter by column value (keys/keysExactMatch)

The columns after Location-column are the same as in your current view.