Replacing Classic UI .tcgi links

this article applies to Funnelback 15.0 - 15.12.

Background

This article provides a workaround for database and directory collections that use the serve-db-document.tcgi or serve-directory-document.tcgi script to show the record. Classic UI was removed from Funnelback v15.0.

Process

Create a hook.post_datafetch.groovy script for the collection containing the following code:

hook_pre_datafetch.groovy
// Replace database and directory collection Classic URLs with the cache link
if ( transaction.response != null
  && transaction.response.resultPacket != null) {
    transaction.response.resultPacket.results.each() {
        if (it.liveUrl =~ /serve-(directory|db)-document\.tcgi/) {
            it.liveUrl =  it.cacheUrl
        }
    }
}

This detects if the classic UI .tcgi script is being used as the record’s live URL and updates this to use the cache URL link which returns the document’s indexed XML.