(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-8457997-9', 'auto'); ga('send', 'pageview');

Generate Signals

Use the Signals API to generate signals.

Generate signals

When a user clicks on a result, the UI can post signal information to the Signals API endpoint (/api/v1/activity/clicks).

Makeup of a signal post

A signal post has these parts:

HTTP request header

An HTTP request for the Signals API must contain the X-API-Key header, a custom HTTP header to contain the Search API key (which is also used for the Signals API).

REST verb

The REST verb for signals is POST.

Signals API endpoint

The URI of the Signals API endpoint is:

/api/v1/activity/clicks

You append this URI to the end of the URL for the Site Search app (everything through pathname):

https://subdomain.lucidworks.cloud/pathname/api/v1/activity/clicks

Request parameters

Specify signal information by including parameters in the URL query string of a signal post.

These are the available parameters.

Parameter Description and example Type

url

URL of the web page to which the user is taken by clicking the result.

https://doc.lucidworks.com/lucidworks-cloud/index.html

string

label

Label of the search result

Lucidworks Cloud documentation

string

rpp (under query)

Results per page

rpp=10

integer

fi (under query)

List of fields that were used in the query

fi=original_title_t,poster_path_ss,genre_ss,year_i,overview_txt,id

comma-separated list

type

Type of the item that is clicked. This must be result.

type=result

string

id

ID of the document that is clicked. Specify the id of a document returned in a query. This connects a document returned in a query response with the clicked document. For a Web Crawler data source, this is typically the URL of the document.

id=https://doc.lucidworks.com/lucidworks-cloud/index.html`

integer

pos

Position of the result that is clicked (that is, the page)

pos=1

integer

offset

Offset in the results

offset=4

integer

Note
If a parameter value contains a reserved character, URL encode the character. You might also need to encode other characters. For example, a query parameter for fusion server would be q=fusion%20server or q=fusion+server.

Example

The starting point is a search query, for example:

Request

curl -H 'X-API-Key: YOUR_API_KEY' 'https://subdomain.lucidworks.cloud/pathname/api/v1/search?p=2&rpp=5&fi=name,url,description&q=cloud'

Response

In this excerpt from the response to the search query, the ID is the long URL:

  "page" : 1,
  "results" : [ {
    "result" : {
      "id" : "https://doc.lucidworks.com/lucidworks-cloud/index.html",
      "fields" : {
        "mimeType_s" : {
          "name" : "mimeType_s",
          "val" : [ "text/html" ]
        },

Signal post

This is a signal post that specifies the same document ID (in the field `id), as well as other fields:

POST https://mycompany.lucidworks.cloud/search/api/v1/activity/clicks

{
  "url": "https://doc.lucidworks.com/lucidworks-cloud/index.html",
  "label": "Lucidworks Cloud",
  "query": {
    "rpp": "20",
    "fi": "mimeType_s,description,type,file_name,url,id",
  },
  "type": "result",
  "id": "https://doc.lucidworks.com/lucidworks-cloud/index.html",
  "pos": 1,
  "offset": 0
}