Autocomplete from Loop54 is inspired by Amazon and empirical studies from Baymard (among others), and consists of queries and faceting on the top query hit as shown below. We build the vocabulary for Autocomplete from previous search queries, so a new engine needs a few searches before returning anything in Autocomplete.
$request = new Loop54_Request("AutoComplete");
$request->setValue("QueryString",$_GET{"query"});
$request->setValue("AutoComplete_FromIndex",0);
$request->setValue("AutoComplete_ToIndex",9);
$response = Loop54_RequestHandling::getResponse("http://helloworld.54proxy.com", $request);
if ($response->success)
{
//print out all strings as a JSON array for the front-end code to use
echo "[";
$items = $response->getCollection("AutoComplete");
for($i=0;$i<count($items);$i++)
{
echo "\"" . $items[$i]->key . "\"";
if($i<count($items)-1)
echo ",";
}
echo "]";
}
else
{
echo $response->requestId; //log this
}
POST to http://helloworld.54proxy.com/autocomplete
{
"UserId" : "helloworlduser",
"IP" : "127.0.0.1",
"QueryString" : "app",
"AutoComplete_FromIndex" : 0,
"AutoComplete_ToIndex" : 9,
}
Response: 200 OK
{
"Success" : true,
"HeroId" : "The Huge Husband of the Days",
"Data" : {
"AutoComplete" : [{
"Key" : "apple",
"Value" : 7
}, {
"Key" : "apple tree",
"Value" : 2
}
],
"AutoCompleteFacets" : [{
"Key" : "Fruits",
"Value" : 0.289232444237587
}
],
"AutoCompleteFacetingString" : "apple"
}
}
The API V2X-based Java Connector is no longer supported.
You can view code examples for the V3-based Connector at
https://github.com/LoopFiftyFour/Java-Connector
The API V2X-based .NET Connector is no longer supported.
You can view code examples for the V3-based Connector at
https://github.com/LoopFiftyFour/.NET-Connector
Product overview
Technology