How does it stack up
Those of you who work with Drupal, you are probably familiar with the combination of using Search API with a search backend such as MySQL or Solr. A pluggable architecture makes Search API a good choice for indexing content in Drupal.
For a long time MySQL and Solr were the popular choices. MySQL was an easy choice as performance was good and results were OK. For those working with large datasets and many concurrent facets, Solr made more sense. Most Drupal hosting companies provide it as a service for this reason. As the search market has matured, other backends have become available, including one for Sajari.
The table below compares these three options and highlights the strengths and weaknesses of each.
Feature | Database | Solr | Sajari |
---|---|---|---|
Separate service | No Built into Drupal. | Yes Drupal hosting companies provide a Solr as SaaS. | Yes Sajari is available as a SaaS. |
Full text search | Yes | Yes | Yes |
Facets | Yes | Yes | Yes |
More like this | No | Yes A useful feature for providing item recommendations based on similarity. | No |
Result quality | OK | Good | Very good |
Performant | Partial Slow with many filters over large datasets with facets. | Yes | Yes |
Easy install | No Requires a module such as Search API Database to push data across to Solr. | No Requires a module such as Search API Solr to push data across to Solr. | Yes We can configure Sajari in the Sajari UI to run from metadata on the page. Sajari provides an embeddable widget. We recommend the Search API Sajari module approach. |
Search API Integration | Yes Search API Database module | Yes Search API Solr module | Yes Search API Sajari module |
Federation | No | No | Yes A site parameter can be passed into the index for easy filtering. |
ReactJS components | No | No | Yes Interface is faster than Search API as server round trips are not needed. |
Result tracking | No | No | Yes Built-in metrics understand page trends and poorly performing keywords to help you see what searches led your users to individual pages, or which content visitors are searching for but can’t find. |
Reporting | No Reports can be set up in analytics software. | No Reports can be set up in analytics software. | Yes Sajari provides logs and charts of search requests. |
Autocomplete - suggestions | Yes Extra module can be installed. | Yes Extra module can be installed. | Yes |
Synonyms | No | No | Yes Libraries of synonyms can be uploaded via Sajari UI. |
Typos | No | No | Yes Support for misspelled words. |
Boosting | Limited | Limited | Yes Advanced rules can be defined on certain plans. |
Machine learning | No | No | Yes Sajari will learn which results are more or less relevant, promoting the best results to the top. |
Pricing | Free Database comes with Drupal hosting. | Included Solr server comes built in with typical Drupal hosting. | Free and up Starts free for smaller sites and then increases. |
Summary | An easy, low cost search solution. | A more scalable solution with handy features such as “more like this”. | A fast system with smart results helpful for those looking for synonyms, results boosting, tracking and reporting. |
Sajari is a viable alternative for clients who are looking for more insights into how their audience use the search on their site and more control over the delivery of the results. This is the case for content driven sites as well as for ecommerce configurations where preferences play a big role.
Integrating Sajari with Drupal
The Sajari Widgets
It is possible to implement Sajari search into any website without the need for the addition of modules or custom code in the backend. Sajari provides a set of widgets which will allow search to operate without the need for much technical knowledge.
Firstly, a Javascript tracking code will allow for “instant indexing”. When a user visits a page, the code fires up and tells Sajari about the page. Sajari can then visit and index the page to update its index. This approach is simple to set up but has its downsides - freshly updated or deleted content will not make it into the index immediately. If this is a concern, then using Search API Sajari, below, would be an alternative.
Secondly, Sajari offers a tool in the admin UI to define a search form and results. It covers things such as the search query, filters, tabs, result counts and result display. It is very easy to configure. The result is a snippet we can embed onto your search page. A set of ReactJS components drive the search and return results in lightning speed, leading to a good experience for users.
Drupal Module: Search API Sajari
For those looking for a tighter integration between their Drupal site and Sajari, it is possible to use their API to push updated content across. The Search API Sajari module , authored by the developers at Morpht, provides a backend to the venerable Search API module This will update Sajari when content is updated on your Drupal site.
The main advantages of this approach are:
- Content is indexed instantly, even when no one views it;
- Deleted content is removed from the index immediately;
- The tools within Search API allow for the fine tuning of the various fields;
- There is support for sending a site name across in the result, allowing for federation of results.
Drupal Module: Sajari
The widgets provided by Sajari offer a quick way to get up and running with a search page. However, there are some limitations in the way they work. At the time of writing (early 2021) the widgets did not support the definition of facets.
In order to overcome this shortcoming, Morpht developed a ReactJS library which sits on top of the components provided by Sajari. It has quite a number of configuration options for queries, result counts, filters, tabs and facets. It even has the ability to customise the results through the provision of a callback function which can convert the JSON result to HTML. This code is available at Sajari Configuartor.
The Sajari module makes use of Sajari Configuartor to power the way search is implemented. The module provides a block for defining how the search will operate. The configuration is then passed through to the Sajari Configurator and the UI and results are then shown.
The Sajari module also makes use of the JSON Template module which allows for different handlebars templates to be defined by the themer. These templates can then be selected by an editor during the block creation process. The select template then forms the basis for the callback which is passed into the Sajari Configuartor. The result is that editors can select how to show results. There is no need to alter the ReactJS templates which are in the library.
A recipe
If you are looking to get up and running with Sajari, we recommend this process:
- Sign up for a free account at Sajari;
- Set up an initial collection in Sajari, but add no fields;
- Install JSON Template, Sajari and Search API Sajari;
- Configure Search API Sajari with your collection details in a new Server;
- Define your Node Index and assign it to the Sajari server you have just created. The schema will be updated automatically in Sajari with the changes you make in Drupal;
- Confirm that content is being indexed properly;
- Add a Sajari search block to your search page and configure it. Be sure to use the correct pipeline and get the field names right;
- Test the search and confirm it is working.
Conclusion
Sajari is an up-and-coming search provider offering a new breed of search which can utilise human behaviour to improve the results it shows. It's useful for content heavy and ecommerce sites which have a strong need for good search results. There are now integration modules for Drupal to get you up and running with Sajari easily.
Is Sajari right for you?
If you currently have a Drupal site based on a different engine and are interested in what Sajari can offer you, please get in touch with us to discuss it further.