Search with Search Clusters - Fluid Topics - 3.8

Integrate Fluid Topics API

Product
Fluid Topics
FT_Version
3.8
Category
Technical Notes

Clustered search consists in getting results clustered according to defined facets.

For instance, search results can be clustered based on the product they concern.

Fluid Topics search feature is available through a Global Clustered Search web service in order to get all information from documents directly from the Fluid Topics server:

/api/khub/clustered-search

The following picture shows how results clustered in a turnkey Fluid topics portal can be displayed in another portal.


The Global Clustered Search web service principle

Many parameters can be passed to the web service, such as keywords or facets. The web service returns a list of all matching documents, with all versions for each. The facets can be defined to create clusters. The cluster returns the number of documents corresponding to each facet value.

For instance, by using the Global Clustered Search web service, it is possible to get the following graphical result, according to your CSS choices.

For each facet, all the values found are displayed with their number of matching results.


Clustered search results displayed in a portal other than the turnkey portal
The following lines show an example of the Global Clustered Search web service implementation in PHP. Product and AFS_Version facets are defined as cluster criteria.
Note: The tenant URL must be statically or dynamically specified with the API path.
<?php
...
   if( is_null( $filter ) )
      $filter = array();
   $data = array(
	  "query" => $query,
	  "contentLocale" => "en-US",
	  "paging" => array( "page" => $page, "perPage" => 20 ),
      "facets" => array(array("id" => "Product"),array("id" => "AFS_Version")),
	  "filters" => $filter
	  );
   ...
   $url = $this->tenant . "/api/khub/clustered-search";
...
?>

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

<html>
<head>
<style>...</style
</head>
<body style="background-color: azure;">
<div id="search">...</div>
...
<script>
$('#query').autocomplete({...});

...
                            
function Search(){
data = {...};
$.get(
'example_use_search.php',
...;
$('.facet').jstree();
   $('#facet1').on("changed.jstree", function (e, data) {...});
   $('#facet2').on("changed.jstree", function (e, data) {...});
   $('#facet3').on("changed.jstree", function (e, data) {...});
...
}
);
}
                                    
</script>
</body>
</html>