Why do my custom results display "no content" on the list result page?

My custom results are showing “no content” after a search in the results page and I can’t customize the description on my Swiftype dashboard. this happen when I add a custom order in my results controls tab.

This is happening because positioned results do not have highlights (since they match the search result by being manually ranked instead of a search hit).

Your renderFunction looks like this:

var customRenderer = function(documentType, item) {
  var data = {
    title: item['title'],
    url: item['url'],
    body: item.highlight['body'] || 'No content.'
  };
  return resultTemplate.render(data);
};

You need to handle the case where item.highlight[‘body’] is not present.

Try something like this:

item['highlight']['body'] || Swiftype.htmlEscape(item['body'])

The item[‘body’] field may have HTML in it (it depends how you are indexing the content) so it should be escaped. The highlighted version is already HTML escaped with the exception of the highlighting tags.

Also, the item[‘body’] field is not truncated, so you may want to do that in your code.