LiftIgniter Search is currently in Beta. If you'd like to join, please reach out to Support to schedule your account for inclusion!


With the retirement of Google's Site Search, LiftIgniter has taken the leap into providing search results for your content, with minimal additional work needed. We’ll take your query and match the request to the content and metadata available in our inventory.


LiftIgniter Search will perform best if categories, keywords, item descriptions, and partial content snippets or other information are made available to us within the metadata. The more data we have about a single piece of content, the more likely we are to be able to match a user’s query to the right item.


By default, LiftIgniter will match any query exactly. If there are no exact matches, it will retry with the stem of the word. 

Example: No matches for “apple”. Stemmed to appl*. Results may contain “apply” or “applause”.


Query Structure

The endpoint for this request is specific to each account. As a result, the URL for the endpoint includes the account’s Javascript key(jsk):


http://query-<jsk>.petametrics.com/v2/model?widgetName=search


You can find your jsk in your LiftIgniter Lab account. Within the sample snippet you will see the following line near the bottom:

$p('init', “<jsk>”);


Sample key: 5he47sdrfo2349ix


You’ll also use the jsk as a parameter within the query itself.


Parameters

widgetName
Required (string)
Value must be "search".

q

Required (string)

Enter the query value here

jsk

Required (string)

The Javascript key for your account

facets

Optional (array of strings)

LiftIgniter can provide a breakdown of how many of the search results are associated with other tags in your metadata. Include a list of each parameter you are interested in including in an array 

offset

Optional (integer)
Default: 0

If a query returns more matches than requested, you can paginate the results by including the offset


You can also use any other parameters that are usable with the standard /model query.


Complete Query

https://query-{{your_jsk}}.petametrics.com/v2/model?widgetName=search&jsk={{your_jsk}}&amp;maxCount={{number of results to return}}&amp;requestFields=[%22url%22,%22description%22,%22title%22,%22field1%22,%22field2%22,%22field3%22]&amp;offset=0&amp;q={{query}}



Response Structure

The response will be a JSON array. The first section will be the list of URLs in rank order in the “items” array, and functions exactly the same as the standard /model response. The second section is “searchInfo”. This includes the following information:


"searchInfo" : { 
"query" : "apple",
    "latency" : 5, // the number of milliseconds required to generate the results
    "matches" : 27, // the total number of items matching the query
    "offset" : 20, // if a query returns more matches than requested, you can paginate the results by including the offset
    "shown" : 10, // the number of recommendations shown in the “items” section
    "facets" : // the breakdown of the number of search items associated with each of the parameters specified
     {  "topics" : {
        "health" : 3,
        "economy" : 2,
        "environment" : 3,
        "money" : 2
      },
      "channel" : {
        "stories" : 24,
        "videos" : 1
      }
    }
}


Tracking Search

It is important to track Search results the same way you would any other widget. This will allow us to collect data over time regarding the effectiveness of our search system (remember, this is a beta!) and allow for potential optimizations down the road. This can be done by applying $p(track) to the div containing the search result display. Make sure that each item in the search results is captured correctly.


$p("track", {
  elements: document.querySelectorAll("ITEM_SELECTOR"),
  name: "search",
  source: "LI"
})