Examples - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.9
Category
Reference Guide

Here is a simple example of a KWIC object that can be found in a AFS reply feed:

var kwic = {
"afs:t": "KwicString",
"text": "Access to AFS Standard Reply Attributes"
};

AFSWidget.sdk.search.reply.kwic.serializeToString(kwic)
→ "Access to AFS Standard Reply Attributes"
AFSWidget.sdk.search.reply.kwic.serializeToHtml(kwic)
→ "Access to AFS Standard Reply Attributes"

Now, considering a list of KWICs:

var kwics = [
{
"afs:t": "KwicTruncate"
},
{
"afs:t": "KwicString",
"text": ", are not simple string attributes, but described in the "
},
{
"afs:t": "KwicMatch",
"match": "KWIC"
},
{
"afs:t": "KwicString",
"text": " format For more information about "
},
{
"afs:t": "KwicMatch",
"match": "KWIC"
},
{
"afs:t": "KwicString",
"text": " format, see Wikipedia."
}
];

the serializing will be:

AFSWidget.sdk.search.reply.kwic.serializeToString(kwics)
→ "..., are not simple string attributes, but described in the KWIC format For more information about KWIC format, see Wikipedia."
AFSWidget.sdk.search.reply.kwic.serializeToHtml(kwics)
→ "..., are not simple string attributes, but described in the <span class="match">KWIC</span> format For more information about <span class="match">KWIC</span> format, see Wikipedia."