Provide Suggestions in the Search Box - Fluid Topics - 3.4

Integrate Fluid Topics API

Product
Fluid Topics
FT_Version
3.4
Category
Technical Notes

The Suggest feature suggests publications, such as books or topics, in a drop-down menu, as users are typing the first characters of their keywords in the search box.

For instance, when typing the first two characters of "administration", the following books, articles, or topics are suggested in a drop-down menu.


Suggestions on the doc.antidot.net portal

The feature is also available through the Suggest web service :

/api/khub/suggest

The following picture shows how the Suggest feature can be used otherwise than by using the turnkey portal:


Suggest web service principle

For instance, the following picture illustrates another UI using the Suggest web service :


Suggestions with a web service in another portal than Antidot Technical Publications

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

Note: The tenant URL must be statically or dynamically defined with the API path.
<?php
...
public function get_suggest( $query = null )
  ...
    $data = array(
	   "input" => $query,
	   "contentLocale" => "en-US"
	   );
    ...
    $url = $this->tenant . "/api/khub/suggest";
...
?>

The following example shows a HTML file setting the web page output. It embeds the Suggest web service function.

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