Skip Navigation
Show nav
Heroku Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
View categories

Categories

  • Heroku Architecture
    • Dynos (app containers)
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Command Line
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery
    • Continuous Integration
  • Language Support
    • Node.js
    • Ruby
      • Working with Bundler
      • Rails Support
    • Python
      • Background Jobs in Python
      • Working with Django
    • Java
      • Working with Maven
      • Java Database Operations
      • Java Advanced Topics
      • Working with Spring Boot
    • PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
    • Heroku Data For Redis
    • Apache Kafka on Heroku
    • Other Data Stores
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
    • Compliance
  • Heroku Enterprise
    • Private Spaces
      • Infrastructure Networking
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
    • Single Sign-on (SSO)
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Add-ons
  • All Add-ons
  • Searchify
Searchify

This add-on is operated by Searchify

Awesome search & autocomplete, with real-time updates and customizable results.

Searchify

Last updated October 09, 2019

Table of Contents

  • Installing the add-on
  • Local workstation setup
  • Installing the client library
  • Testing your application
  • Pushing to Heroku
  • Migrating between plans
  • Dashboard
  • Further reading

Searchify is an add-on that provides hosted full-text search.

Searchify allows developers to easily add search to their applications, without having to deal with Solr or Lucene, and without the hassle of managing a search infrastructure. Searchify is fast. Most search queries will be answered in under 100 milliseconds. Searchify offers true real-time search, so documents added are immediately searchable. Searchify is a drop-in replacement for existing IndexTank users.

Searchify has client libraries for Ruby, Python, Java, PHP, and others, all of which communicate with Searchify’s REST API.

Installing the add-on

Searchify can be installed using the following addons:create command, and replacing <PLAN> with the name of the searchify plan desired:

Searchify offers plans based on the number of documents stored. A list of all plans available can be found on the Searchify add-on page.

$ heroku addons:create searchify:<PLAN>
-----> Adding searchify:<PLAN> to mycoolapp... done

This will create an account on Searchify associated with the Heroku user, with one empty index called “idx”. You may use this “idx” index or delete it and create a new one anytime.

Once Searchify has been added, a SEARCHIFY_API_URL setting will be available in the app configuration, and will contain the private API URL used to access the newly-provisioned Searchify service from within your application.

$ heroku config | grep SEARCHIFY_API_URL
SEARCHIFY_API_URL    => http://:secret@xyz.api.searchify.com

Local workstation setup

To test the service in a local development environment, retrieve the environment variables from heroku using the following command:

$ heroku config --long | grep SEARCHIFY

The SEARCHIFY_API_URL is the private URL used to access the Searchify service from within a local environment. Typically developers will create one search index for testing and one for production.

The next step is to install the appropriate language client library to develop locally with Searchify.

Installing the client library

Searchify may be accessed using one of the IndexTank client libraries.

Installing the IndexTank Gem (Ruby)

Ruby/Rails applications should add the following entry into their Gemfile specifying the IndexTank client library required to access Searchify:

gem 'indextank'

For local development, install the indextank gem:

$ gem install indextank

Now the client can be used to add documents to your index and perform searches. The following code sample demonstrates basic document indexing and search, and may be copied for use in apps you develop. Remember: <API_URL> must be replaced with the value of the SEARCHIFY_API_URL from the previous step, and <INDEX_NAME> with the name of an index you wish to search (such as the “idx” index initially created):

require 'rubygems'
require 'indextank'

# Obtain an IndexTank client
client = IndexTank::Client.new(ENV['SEARCHIFY_API_URL'] || '<API_URL>')
index = client.indexes('<INDEX_NAME>')

begin
    # Add documents to the index
    index.document("1").add({ :text => "some text here" })
    index.document("2").add({ :text => "some other text" })
    index.document("3").add({ :text => "something else here" })

    # Search the index
    results = index.search("some")

    print "#{results['matches']} documents found\\n"
    results['results'].each { |doc|
      print "docid: #{doc['docid']}\\n"
    }
rescue
    print "Error: ",$!,"\\n"
end

Using Searchify with PHP

Download the IndexTank PHP client from GitHub and require it in your code. Remember <API_URL> must be replaced with the SEARCHIFY_API_URL value from the previous step.

include_once "indextank.php";

// load the API URL from the environment if available.
$API_URL = getenv('SEARCHIFY_API_URL') ? getenv('SEARCHIFY_API_URL') : '<API_URL>';

$client = new Indextank_Api($API_URL);
$index = $client->get_index("<YOUR INDEX NAME>");

// Add documents to the index
$index->add_document("1", array("text"=>"some text here"));
$index->add_document("2", array("text"=>"some other text"));
$index->add_document("3", array("text"=>"something else here"));

// Search the index and show the results
$res = $index->search("some");
echo $res->matches . " results\n";
foreach($res->results as $doc) {
  print_r($doc);
  echo "\n";
}

Testing your application

Using the code pattern above, you should be able to test applications both locally and running on Heroku. Keep in mind that your tests affect the live search index. An index may be deleted and re-created anytime to clean it up, either from code as shown below or from Searchify’s dashboard:

Deleting an index (Ruby)

client = IndexTank::Client.new(ENV['SEARCHIFY_API_URL'] || '<API_URL>')
index = client.indexes('<INDEX_NAME>')
index.delete()

Creating a new index

client = IndexTank::Client.new(ENV['SEARCHIFY_API_URL'] || '<API_URL>')
index = client.indexes('<INDEX_NAME>')
index.add()

print "Waiting for index to be ready"
while not index.running?
    print "."
    STDOUT.flush
    sleep 0.5
end
print "\\n"
STDOUT.flush

Pushing to Heroku

You should be able to use Searchify from within applications running on Heroku after the usual push commands:

$ git commit
$ git push heroku master

Migrating between plans

If you require a plan larger than those listed, we can provide custom plans. Please contact us at support@searchify.com.

If you outgrow the limits of your current Searchify plan, it’s easy to change to a larger plan. Any data in your search indexes is preserved – no data is lost.

Use the CLI to migrate to a new plan.

$ heroku addons:upgrade searchify:plus
-----> Upgrading searchify:plus to myapp... done ($49/mo)
       Your plan has been updated to: searchify:plus

Dashboard

The Searchify dashboard allows you to manage your search indexes, allowing you to create, delete, and search indexes. Custom scoring functions can also be configured. The dashboard can be accessed by visiting the Heroku Dashboard and selecting Searchify from the add-ons menu.

Searchify Add-ons Dropdown

Further reading

For more information on the features available from Searchify, including faceted search, geolocation, snippets, autocomplete, and custom scoring functions, please see the documentation at www.searchify.com/documentation.

More information:

  • Searchify Tutorials
  • StackOverflow Searchify questions
  • Ruby client
  • Python client
  • Java client
  • PHP client

Keep reading

  • All Add-ons

Feedback

Log in to submit feedback.

Ziggeo Semaphore

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Podcasts
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing

Subscribe to our monthly newsletter

Your email address:

  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Heroku Podcasts
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Facebook
  • Instagram
  • Github
  • LinkedIn
  • YouTube
Heroku is acompany

 © Salesforce.com

  • heroku.com
  • Terms of Service
  • Privacy
  • Cookies
  • Cookie Preferences