A month ago, we already wrote about the contextual
help service
Suggest.io (
http://habrahabr.ru/blogs/startup/110509/ ). The first wave of beta testing was successful, we decided to expand the capabilities of the service.

What's new?
In the new version of Suggest.io, we have introduced some really interesting innovations. But more on that later.
')
The main thing is that our service has become as accessible as possible to all user groups, incl. for novice developers. Having worked on interfaces and usability, we have significantly simplified the creation and implementation of hints on client resources.
Now configuration and installation of the basic version of Suggest.io takes no more than ten minutes and occurs in 4 steps:
1. Adding a new site
2. Assigning a new field to a site
3. Customize the appearance of the hints field
4. Installing scripts (copying several lines of JS code)
Search
One of the most significant changes is that Suggest.io can now be configured to search not only at the beginning of a line, but also according to an exact match of the phrase in the entire prompt.
You can customize the search method on the Preferences page.
New storage options
While working on the service, we thought that it might still be needed in the Suggest.io windows on client sites. Probably, it would be nice to organize the display of tips with pictures. And even better, display descriptions of tips and group them into categories: products, promotions, events, people, etc .; in accordance with the topic and rubrication of the client site.
After going through a thousand options, we came to the conclusion - the user must decide for himself what and how to store. So we did.
Now you can set up automatic interaction between Suggest.io and the client site through the HTTP API. Set up the synchronization of the database of your site and the database of your profile on Suggestio. Use descriptions, pictures, categories, links - all you need. List news categories, photo galleries, reviews, and most popular searches in the fields. And all this will appear in the general Suggest.io tooltip field, simultaneously, by the first letters of the request.
Suggestio API
Currently four functions are implemented:
- clear (for complete cleaning of the base);
- import (for importing hints from .CSV);
- export (for exporting your databases from Suggest.io servers);
- log (used for debugging).
AuthorizationIn order to make calls to the functions of Suggest.io API, it is necessary to use inter-server authentication.
Suggestio HTTP API supports HTTP Digest Authentication with qop = auth directive. You can read more about this type of authorization in
RFC2617 .
An example of authorization using curl:
curl --digest --user my-server:my-passkey ...
where
my-server and
my-passkey are the id and secret key of your site, respectively. You can find them on the Manage websites page.
ImportUsing import you can set up automatic synchronization of your site’s database with a database on Suggest.io.
The function call syntax is as follows:
http://suggest.io/api/v1/suggests/import/<field-name>/<column-definition>
where
<field-name> is the id of the field to import to, <column-definition> is the format of your .CSV file with prompts (variable names, separated by dots).
Consider a few examples.
Suppose we have a .CSV file with hints like:
bananas,2,fruit tomato,2,vegetable apple,1,fruit
then the call to the import function will look like this:
http://suggest.io/api/v1/suggests/import/fruits_and_vegetables_field/suggest.rating.kind
Please note that the use of the suggest variable is required! The remaining variables can be set arbitrarily.
Thanks to variables, you can work with the necessary data at the stage of setting up the appearance of prompts.
ExportUsing this API function you can get a dump of the base of any of your fields in .CSV format.
Function call syntax:
http://suggest.io/api/v1/suggests/export/<field-name>/<column-definition>
Currently supported Column Definition type suggest.rating and rating.suggest
ClearThe function is designed to completely clear the database for the selected field.
Function call syntax:
http://suggest.io/api/v1/suggests/clear/<field-name>
Javascript
In general, the JS code for initialization looks like this:
<script type="text/javascript"> suggestioField = 'new-test-field';
The initialization function creates an element that will contain hints:
<div class="suggestions-container" id="suggestions"></div>
To control the display of blocks with a hint in the JS class Suggestio, the concept of format is provided.
The format is a JS object of the form.
'default':{ suggestionBody: '<div class="one-suggestion" id="suggest/index/">/suggest/</div>', suggestionPrefix: '<div class="prefix"> :</div>', suggestionPostfix: '<div class="postfix"> </div>', onMouseOver:function(event){ }, onMouseOut:function(event){ }, onClick:function(){ }, submitFunction:function(){ } }
suggestionBody - the element contains a description of the appearance of each individual tips;
suggestionPrefix - the element contains the description of the appearance of the prefix for the group of hints. Simply put, this item will display up to the list of prompts;
suggestionPostfix - the element contains the description of the “basement” for the group of hints. This item will be displayed after all the prompts.
Please note that you can use variable substitution in the form / you_var_name /.
The onMouseOver, onMouseOut, onClick elements contain functions that will be assigned to each of the prompts.
submitFunction - is assigned to the form that contains the input field.
In functions, you can access the variables you specify directly.
For example, if you uploaded a file with tips like
suggestion one,10,http://mysite.com/item_one suggestion two,10,http://mysite.com/item_two suggestion two,10,http://mysite.com/item_three ...
and indicate the column definition of the
suggest.rating.suggestion_url type,
then you can use the following format to display:
... onClick:function(){ window.location = suggestion_url }, submitFunction:function(){ window.location = suggestion_url } ...
You can use several different formats. To do this, you must specify a variable by which prompts will be grouped. Consider the example of vegetables and fruits:
bananas,2,fruit tomato,2,vegetable apple,1,fruit
Column definition specified during import:
suggest.rating.kind
We use for grouping by type the variable kind. Add the following directive before the initialization function:
... suggestio.formatColumn = 'kind'; suggestio.initSuggestio();
Now we will set two different formats for fruits and vegetables.
The format can be set using the function
suggestio.defineFormat('format_name', format_object);
Vegetables:
suggestio.defineFormat('vegetable', { suggestionBody: '<div class="vegetable-suggestion" id="content/index/">' + '/suggest/ (/kind/)' + '</div>', suggestionPrefix: '<div class="vegetable-prefix">Check out our vegetables:</div>', suggestionPostfix: '<div class="vegetable-postfix"></div>' });
Fruits:
suggestio.defineFormat('fruit', { suggestionBody: '<div class="fruit-suggestion" id="content/index/">' + '/suggest/ (/kind/)' + '</div>', suggestionPrefix: '<div class="fruit-prefix">Check out our fruits:</div>', suggestionPostfix: '<div class="fruit-postfix"></div>' });
If you have any questions, our support team is always happy to answer them by email
support@suggest.io !