OLD Algolia

Algolia is an AI-powered search and discovery platform for dynamic experiences. It helps businesses discover and access the necessary content quicker and more efficiently.

Marketplace lets you install and use the Algolia application to update Algolia indices whenever entries and assets are published, unpublished, or deleted from Contentstack.

Prerequisites

This step-by-step guide explains how to install and configure Algolia within your stack.

Steps for Execution

  1. Retrieve Algolia Credentials
  2. Install and Configure Algolia in Contentstack Marketplace
  3. Use Algolia within your Stack
  1. Retrieve Algolia Credentials

    To configure the app, you need to get the application_id and index name from Algolia. To do that, follow the steps gives below:

    • Login to your Algolia account.
    • Click on the Settings button in the left navigation bar, under Team and Access open the API Keys option.
    • Keys are available here if they are already created: 
    • Click to enlarge

      Note While creating new API keys, make sure you select the Indices. Also, provide the ACL options to perform indexing, as shown below: 

      Click to enlarge
      Click to enlarge
    • On the API Keys page you will get an Application ID, copy the Application ID and note it down, you will need it to configure your app in Contentstack. 
    • Click to enlarge
    • Click on the copy icon in the search dashboard to save or copy the index name as shown below: 
    • Click to enlarge

      Now that you have the required credentials to configure the app, goto Contentstack and set up the app.

  2. Install and Configure Algolia in Contentstack Marketplace

    To install the application in Contentstack, follow the steps below:

    1. Login to your Contentstack account.
    2. On the left-hand side primary navigation, you will find the Marketplace icon (as shown below). Click on the icon to go to the Marketplace. 
    3. Click to enlarge
    4. Within the Marketplace, you will be able to see all the apps available, hover over the Algolia app and click on Install App
    5. Click to enlarge
    6. On the next screen, select the stack where you want to install the Algolia app, click on the checkbox to agree to the Terms of Service and Privacy Policy, and click on Install
    7. Click to enlarge
    8. On the Configuration page, enter the Algolia credentials that we retrieved in step 1. 
    9. Click to enlarge
    10. Select the Add Configuration button to add more configurations.
    11. If you want to add Webhook triggers to specific content types with selected mapping rules, click on the Additional settings toggle and add rules. 
    12. Click to enlarge

      Note Ensure that atleast one configuration is added before you go for additional settings.

    13. Click on the Add Rule button to add one or more rules, by selecting content type and appropriate mapping fields.

      Note 1. The webhook will be triggered only for the content types added in mapping rule(s).
      2. The added rules(s) will be applicable for all environments selected in the previous configuration.

    14. Select Trigger Webhook for all Content Types checkbox if you want to trigger the webhook for all the content types along with the content types for which rules are set by selecting mapping fields. 
      If we select this option, the content types with the specified rules will be added to Algolia with the rules and the data from other content types will be added to Algolia as it is.
    15. Select Trigger Webhook for Asset checkbox if you want to trigger the webhook for assets. 
      Selecting this option will add your assets data to Algolia index on publishing. Similarly, this option will remove your data from Algolia index on performing unpublish/delete.
    16. Click to enlarge

      Using the “+ Add Field” option in the Mapping Fields dropdown, you can map nested or complex structures.

      Click to enlarge

      For example,

      • While mapping nested fields, you must specify the object and its field using the dot(.) notation. For example, Object.age for accessing the age field within the object.
      • While mapping arrays, use indexing. For example, Array[1] for accessing the second value of an array.
      • You can use the above rules to create mapping rules for complex structures that include objects and arrays.
      Click to enlarge
    17. Click on Save and Open Stack to start using the Algolia application.
  3. Use Algolia within your Stack

    To use the Algolia application in an entry of your stack, follow the steps given below:

    1. Go to your stack and click the “Content Models” icon on the left navigation panel, and click on the + New Content Type button.
    2. Create a content type by adding relevant details and click on the Save and proceed button
    3. Click to enlarge
    4. In the Content Type Builder page, add the required fields in your content type. Now create an entry within the content type we just created and add details as shown below: 
    5. Click to enlarge
    6. Save your entry and publish in the environment you selected while configuring the app in the step 5
    7. Click to enlarge

      Note Publish the entries only in the environment you select while configuring the Algolia app.

    8. Navigate to your Algolia app index to see the published entry indexed in the publish event. 
    9. Click to enlarge

      Note 1. If you unpublish/delete an entry on a specified environment, the entry will be deleted from Algolia's index.
      2. If you delete a content type, all the published entries of that content type that were added to Algolia will be deleted from Algolia's index.

View Algolia analytics in the dashboard (Optional)

The dashboard displays data coming from multiple environments of the Algolia app.

  1. In the configuration page, select the environment which you want to make as the default environment. 
  2. Click to enlarge

    Note If you don't choose a default environment, then the first environment in the configuration will be displayed as the default environment in the dashboard.

  3. In the dashboard, select the dropdown in the top-right corner of the table to display data for a specific environment.
  4. Click to enlarge

  5. You can view the data for Top Searches and Top Searches With No Results by switching between the tabs.