Search for texts that are related to a group. Returns an array named "related_texts" containing the result.

Request Parameters

group_idint (required)
The group id the texts should be related to.
collection_scopeint (required)
The collection(s) in which we search for related texts.
waitint (default: 5)
Maximum time you want to wait for a result to be calculated. Maximum wait time is 60 sec. If wait time is zero (0) you will only start the process and disconnect and can check out the result later. An exception will be thrown saying processing request. (See Error Codes)
limitint (default: 10)

The max number of related texts you want in your result set. There is no guarantee that the number of results will equal the limit. Max 50.

Response Parameters

Collection id for resulting text.
Id for resulting text.
The relevance value for the text compared to the context.

External text id

Code Examples




// You need to have a ready-to-use client to use the other methods
SaploClient client = new SaploClient("YOUR_API_KEY", "YOUR_SECRET_KEY");

// Create a SaploGroupManager to work with groups
SaploGroupManager groupMgr = new SaploGroupManager(client);

// Assuming you already know the ID of your group
SaploGroup group = new SaploGroup();

// Find texts that are related to the group in a given set of collections
// waitTime is the number of seconds you would wait for the API to return
// limit is the maximum amount of texts
SaploCollection[] collectionScope = {col1, col2, col3};
groupMgr.relatedTexts(group, collectionScope, waitTime, limit);

// The related texts can now be retrieved by .getRelatedTexts(); 
// on the group object
// Print the result
for(SaploText related : group.getRelatedTexts())
    System.out.println("Related text Id: " + related.getId() 
        + " relevance: " + related.getRelatedRelevance());


$client = new SaploAPI("YOUR API KEY", "YOUR SECRET KEY");

$params = array(
    "group_id" => 21,
    "collection_scope" => 606

try {
    $result = $client->group->related_texts($params);
} catch(SaploException $e) {
    echo '(' . $e->getCode() . ') ' . $e->getMessage();


params.group_id = 415;
params.wait = 10;
params.collection_scope = 2131;

response = saploRequest('group.relatedTexts', params)