How can I include images in my search results?

I have a lot of different images on my website and I want my site search box to return results with those images. Will Swiftype’s custom site search engine be able to show the images in results like I want?

Swiftype does not inherently index image files, so the usage is somewhat limited for image/file search. However, there are some work arounds depending on your engine type.

Crawler Engines

Since we predominantly crawl HTML content, your best means of having searchable images would be to create a unique landing page for each image. An example landing page would include some or all of the following:

  • the image embedded within the page
  • details about the image (title, aspect ratio, file size, available sizes, description photographer, etc)
  • download links for the image

With that data in place, our crawler would be able to index those pages and enable meaningful search for your images.

WordPress Engines

Indexing images via the Swiftype plug-in for WordPress is a bit more direct, as you can configure your theme to update the post_status of the attachment post type from inherit to publish.

Once that change is saved and you resynchronize the Swiftype plug-in, you should find records of attachments available in site search. We’ve a relevant thread relating to post type indexing with our WordPress plug-in below: