search mobile facets autocomplete spellcheck crawler rankings weights synonyms analytics engage api customize documentation install setup technology content domains user history info home business cart chart contact email activate analyticsalt analytics autocomplete cart contact content crawling custom documentation domains email engage faceted history info install mobile person querybuilder search setup spellcheck synonyms weights engage_search_term engage_related_content engage_next_results engage_personalized_results engage_recent_results success add arrow-down arrow-left arrow-right arrow-up caret-down caret-left caret-right caret-up check close content conversions-small conversions details edit grid help small-info error live magento minus move photo pin plus preview refresh search settings small-home stat subtract text trash unpin wordpress x alert case_deflection advanced-permissions keyword-detection predictive-ai sso
Site Search Documentation / styleguide: Tags

Headers:

Heading 1

Content.

Heading 2

More content.

Heading 3

Even more content.

Heading 4 w/ id

Even more more content.

Links:

Absolute link

Relative link

Path-based link (see sitebars.yml for mapping)

Support email with premade message

Liquid helper to be used inside html tags. Parsed the same way as other links

Keys:

GET /api/v1/engines/{engine_id}/document_types/{document_type_id}/documents.json
POST /api/v1/public/engines/search?q={query}&engine_key={your engine key}
PUT /api/v1/public/engines/search?q={query}&engine_key={your engine key}
DELETE /api/v1/public/engines/search?q={query}&engine_key={your engine key}

Swiftype.resultPage

Code Snippets:

Small code sample

string

HTML

<!-- Assume there are two type values in the search engine: "author_page" and "article" -->
<input type="radio" name="type" value="author_page" id="author_page">
<label for="author_page">Authors</label>

<input type="radio" name="type" value="articles" id="articles">
<label for="articles">Articles</label>

<script type="text/javascript">
var Swiftype = window.Swiftype || {};
Swiftype.searchFilterFields = function() {
  var selectedType = $("input[name=type]:radio:checked").val();

  return {'page': {'filters': {'type': selectedType}}};
};

  (function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
  (w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
  e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
  })(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');

  _st('install','YOUR_INSTALL_KEY');
</script>

Ruby

class Post < ActiveRecord::Base
  validates_presence_of :title
  validates_presence_of :body

  attr_accessible :title, :body
end

Bash / Curl

curl -XGET 'https://api.swiftype.com/api/v1/engines/bookstore/document_types/books/search.json' \
  -H 'Content-Type: application/json' \
  -d '{
        "auth_token":"ynoYdUDjdcqg753vBGu6",
        "q":"brothers"
      }'

curl -XGET 'https://api.swiftype.com/api/v1/engines/bookstore/document_types/magazines/search.json' \
  -H 'Content-Type: application/json' \
  -d '{
        "auth_token":"ynoYdUDjdcqg753vBGu6",
        "q":"dwell"
      }'

Example

Example - Specify a field weight for the title field
Swiftype.searchSearchFields = {
  // Notice that I have included all string and text fields in the list.
  // If I did not include one, it would not be searched
  "page": ["title^5", "sections", "info", "body"]
};
  

Example (curl)

Example - Get autocomplete suggestions from the books DocumentType for the prefix query "act"
curl -X GET 'https://api.swiftype.com/api/v1/engines/bookstore/document_types/books/suggest?q=action&auth_token=ynoYdUDjdcqg753vBGu6'
  

Example w/ response

Example - Use some of the search options.
    curl -X GET 'https://api.swiftype.com/api/v1/engines/bookstore/document_types/books/search?q=action&auth_token=j48v96cYcgsfWnsZQxrE'
  

Example Response

{
  "records": {
    "books": [
      {
        "title": "The Brothers Karamazov",
        "author": "Fyodor Dostoyevsky",
        "price": "14.95"
      },
      ...
    ]
  },
  "info": {
    "books": {
      "query": "brothers",
      "current_page": 1,
      "num_pages": 1,
      "per_page": 20,
      "total_result_count": 18,
      "facets": {}
    }
  },
  "errors": {}
}

Tables:

Field Type Description
external_id enum For crawler-based search engines, the hexidecimal MD5 digest of the normalized URL of the page.
updated_at date The date when the page was last indexed.
title string The title of the page taken from the <title> tag or the st:title meta tag.
url enum The URL of the page.
sections string Sections of the page (determined by <h1>, <h2>, and <h3> tags or the or the st:section
body text The text of the page
type enum The page type (set by the st:type meta tag.
image enum A URL for an image associated with the page (set by the st:image meta tag), used as a thumbnail in your search result listing if present.
published_at date The date the page was published. Specialized crawlers for content management systems like Tumblr may use this field, or it can be set with the st:published_at meta tag. If not specified, it defaults to the time when the page was crawled and so is not particularly useful for queries.
popularity integer The popularity score for a page. Specialized crawlers for content management systems like Tumblr may use this field, or it can be set with the st:popularity meta tag and used to change search result rankings with functional boosts. If not specified, the default value is 1.
info string Additional information about the page returned with the results (set by the st:info meta tag)

Images & YouTube:

Creating an engine

Notices:

The Swiftype Crawler's User-agent is: Swiftbot.