Provide Suggestions in the Search Box - Fluid Topics - 3.6 - Technical Notes

Integrate Fluid Topics APIs

Product
Fluid Topics
FT_Version
3.6
Category
Technical Notes
language
English
audience
public

The Suggest feature proposes document and topic titles while users type the first characters of a keyword in the search box.

For example, when typing the first two characters of "administration," Fluid Topics suggests the following content:

Suggest on a Fluid Topics portal

The Suggest web service returns matching publications and topics based on suggestions entered by end-users:

/api/khub/suggest

It is possible to integrate the Suggest web service in order to use it on an external interface, as in the following image:

Suggest API

The following lines show an example of implementing the Suggest web service in PHP:

<?php
...
public function get_suggest( $query = null )
...
$data = array(
"input" => $query,
"contentLocale" => "en-US"
);
...
$url = $this->tenant . "/api/khub/suggest";
...
?>

It is necessary to statically or dynamically define the tenant URL with the API path.

The following example shows an HTML file that embeds the Suggest web service:

<html>
...
$('#search-text').autocomplete({
source: "example_use_suggest.php",
minLength: 1
});
...
</html>