<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: curquiza</title>
    <description>The latest articles on Forem by curquiza (@clurquizar).</description>
    <link>https://forem.com/clurquizar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F132922%2F35260cc4-7583-4f04-9b71-36fb12d8e923.png</url>
      <title>Forem: curquiza</title>
      <link>https://forem.com/clurquizar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/clurquizar"/>
    <language>en</language>
    <item>
      <title>Integrate a relevant search bar to your documentation with MeiliSearch</title>
      <dc:creator>curquiza</dc:creator>
      <pubDate>Thu, 24 Sep 2020 10:47:33 +0000</pubDate>
      <link>https://forem.com/meilisearch/integrate-a-relevant-search-bar-to-your-documentation-3nl9</link>
      <guid>https://forem.com/meilisearch/integrate-a-relevant-search-bar-to-your-documentation-3nl9</guid>
      <description>&lt;p&gt;You might have noticed the search bar in &lt;a href="https://docs.meilisearch.com/"&gt;our documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fowunn6mzq1j6j8b1jm3z.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fowunn6mzq1j6j8b1jm3z.gif" alt="Alt Text" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And you are probably wanting the same for your own documentation!&lt;/p&gt;

&lt;p&gt;This tutorial will guide you through the steps of building a relevant and powerful search bar for your documentation 🚀&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run a MeiliSearch instance&lt;/li&gt;
&lt;li&gt;Scrape your content&lt;/li&gt;
&lt;li&gt;Integrate the search Bar&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Run a MeiliSearch Instance
&lt;/h1&gt;

&lt;p&gt;First of all, you need your documentation content to be scraped and pushed into a MeiliSearch instance.&lt;/p&gt;

&lt;p&gt;You can install and run MeiliSearch on your machine using &lt;code&gt;curl&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; https://install.meilisearch.com | sh
&lt;span class="nv"&gt;$ &lt;/span&gt;./meilisearch &lt;span class="nt"&gt;--master-key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;myMasterKey
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are &lt;a href="https://docs.meilisearch.com/reference/features/installation.html#download-and-launch"&gt;other ways to install MeiliSearch&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;MeiliSearch is open-source and can run either on your server or on any cloud provider.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The host URL and the API key you will provide in the next steps correspond to the credentials of this MeiliSearch instance.&lt;br&gt;
In the example above, the host URL is &lt;code&gt;http://localhost:7700&lt;/code&gt; and the API key is &lt;code&gt;myMasterKey&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Scrape your Content
&lt;/h1&gt;

&lt;p&gt;The Meili team provides and maintains a &lt;a href="https://github.com/meilisearch/docs-scraper"&gt;scraper tool&lt;/a&gt; to automatically read the content of your website and store it into an index in MeiliSearch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuration File
&lt;/h2&gt;

&lt;p&gt;The scraper tool needs a configuration file to know what content you want to scrape. This is done by providing selectors (e.g. the HTML tag).&lt;/p&gt;

&lt;p&gt;Here is an example of a basic configuration file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"index_uid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"start_urls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://www.example.com/doc/"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sitemap_urls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://www.example.com/sitemap.xml"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"stop_urls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"selectors"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lvl0"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"selector"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".docs-lvl0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"global"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"default_value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Documentation"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lvl1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"selector"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".docs-lvl1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"global"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"default_value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Chapter"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lvl2"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".docs-content .docs-lvl2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lvl3"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".docs-content .docs-lvl3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lvl4"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".docs-content .docs-lvl4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lvl5"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".docs-content .docs-lvl5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lvl6"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".docs-content .docs-lvl6"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".docs-content p, .docs-content li"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;index_uid field&lt;/code&gt; is the index identifier in your MeiliSearch instance in which your website content is stored. The scraping tool will create a new index if it does not exist.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;docs-content&lt;/code&gt; class is the main container of the textual content in this example. Most of the time, this tag is a &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; or an &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; HTML element.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lvlX&lt;/code&gt; selectors should use the standard title tags like &lt;code&gt;h1&lt;/code&gt;, &lt;code&gt;h2&lt;/code&gt;, &lt;code&gt;h3&lt;/code&gt;, etc. You can also use static classes. Set a unique &lt;code&gt;id&lt;/code&gt; or &lt;code&gt;name&lt;/code&gt; attribute to these elements.&lt;/p&gt;

&lt;p&gt;Every searchable &lt;code&gt;lvl&lt;/code&gt; elements outside this main documentation container (for instance, in a sidebar) must be &lt;code&gt;global&lt;/code&gt; selectors. They will be globally picked up and injected to every document built from your page.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TIP: More &lt;a href="https://github.com/meilisearch/docs-scraper#all-the-config-file-settings"&gt;optional fields are available&lt;/a&gt; to fit your need.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you use VuePress for your documentation, you can check out the &lt;a href="https://github.com/meilisearch/documentation/blob/master/.vuepress/docs-scraper/docs-scraper.config.json"&gt;configuration file&lt;/a&gt; we use in production.&lt;br&gt;
In our case, the main container is &lt;code&gt;theme-default-content&lt;/code&gt; and the selector the titles and sub-titles are &lt;code&gt;h1&lt;/code&gt;, &lt;code&gt;h2&lt;/code&gt;...&lt;/p&gt;
&lt;h2&gt;
  
  
  Run the Scraper
&lt;/h2&gt;

&lt;p&gt;You can run the scraper with Docker. With our local MeiliSearch instance set up at the first step, we run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;docker run &lt;span class="nt"&gt;-t&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--network&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;host &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MEILISEARCH_HOST_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'http://localhost:7700'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MEILISEARCH_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'myMasterKey'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-v&lt;/span&gt; &amp;lt;absolute-path-to-your-config-file&amp;gt;:/docs-scraper/config.json &lt;span class="se"&gt;\&lt;/span&gt;
    getmeili/docs-scraper:latest pipenv run ./docs_scraper config.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If you don't want to use Docker, here are &lt;a href="https://github.com/meilisearch/docs-scraper#run-the-scraper"&gt;other ways to run the scraper&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;absolute-path-to-your-config-file&amp;gt;&lt;/code&gt; should be the &lt;strong&gt;absolute&lt;/strong&gt; path of your configuration file defined at the previous step.&lt;/p&gt;

&lt;p&gt;The API key you must provide should have the permissions to add documents into your MeiliSearch instance. In a production environment, we recommend providing the private key instead of the master key, as it is safer and it has enough permissions to perform such requests.&lt;br&gt;
&lt;em&gt;More about &lt;a href="https://docs.meilisearch.com/reference/features/authentication.html"&gt;MeiliSearch authentication&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TIP: We recommend running the scraper at each new deployment of your documentation, &lt;a href="https://github.com/meilisearch/documentation/blob/master/.github/workflows/gh-pages-scraping.yml"&gt;as we do for the MeiliSearch's one&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1&gt;
  
  
  Integrate the Search Bar
&lt;/h1&gt;

&lt;p&gt;If your documentation is not a VuePress application, you can directly go to this section.&lt;/p&gt;
&lt;h3&gt;
  
  
  For a VuePress Documentation
&lt;/h3&gt;

&lt;p&gt;If you use VuePress for your documentation, we provide a &lt;a href="https://github.com/meilisearch/vuepress-plugin-meilisearch"&gt;VuePress plugin&lt;/a&gt;. This plugin is used in production in the MeiliSearch documentation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuk301fod1i5anz76ydv5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuk301fod1i5anz76ydv5.png" alt="Alt Text" width="800" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In your VuePress project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;yarn add vuepress-plugin-meilisearch
&lt;span class="c"&gt;# or&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;vuepress-plugin-meilisearch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your &lt;code&gt;config.js&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vuepress-plugin-meilisearch&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hostUrl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;your-meilisearch-host-url&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apiKey&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;your-meilisearch-api-key&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;indexUid&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;docs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;hostUrl&lt;/code&gt; and the &lt;code&gt;apiKey&lt;/code&gt; fields are the credentials of the MeiliSearch instance. Following on from this tutorial, they are respectively &lt;code&gt;http://localhost:7700&lt;/code&gt; and &lt;code&gt;myMasterKey&lt;/code&gt;.&lt;br&gt;
&lt;code&gt;indexUid&lt;/code&gt; is the index identifier in your MeiliSearch instance in which your website content is stored. It has been defined in the config file.&lt;/p&gt;

&lt;p&gt;These three fields are mandatory, but more &lt;a href="https://github.com/meilisearch/vuepress-plugin-meilisearch#customization"&gt;optional fields are available&lt;/a&gt; to customize your search bar.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;WARNING: Since the configuration file is public, we strongly recommend providing the MeiliSearch public key in a production environment, which is enough to perform search requests.&lt;br&gt;
Read more about &lt;a href="https://docs.meilisearch.com/reference/features/authentication.html"&gt;MeiliSearch authentication&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  For All Kinds of Documentation
&lt;/h3&gt;

&lt;p&gt;If you don't use VuePress for your documentation, we provide a &lt;a href="https://github.com/meilisearch/docs-searchbar.js"&gt;front-end SDK&lt;/a&gt; to integrate a powerful and relevant search bar to any documentation website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhtzyf8heq1k1w3a3bgih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhtzyf8heq1k1w3a3bgih.png" alt="Alt Text" width="800" height="558"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/docs-searchbar.js@{version}/dist/cdn/docs-searchbar.min.css"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"search"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"search-bar-input"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/docs-searchbar.js@{version}/dist/cdn/docs-searchbar.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;docsSearchBar&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;hostUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;your-meilisearch-host-url&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;your-meilisearch-api-key&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;indexUid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;docs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;inputSelector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#search-bar-input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;// Set debug to true if you want to inspect the dropdown&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;hostUrl&lt;/code&gt; and the &lt;code&gt;apiKey&lt;/code&gt; fields are the credentials of the MeiliSearch instance. Following on from this tutorial, they are respectively &lt;code&gt;http://localhost:7700&lt;/code&gt; and &lt;code&gt;myMasterKey&lt;/code&gt;.&lt;br&gt;
&lt;code&gt;indexUid&lt;/code&gt; is the index identifier in your MeiliSearch instance in which your website content is stored. It has been defined in the config file.&lt;br&gt;
&lt;code&gt;inputSelector&lt;/code&gt; is the &lt;code&gt;id&lt;/code&gt; attribute of the HTML search input tag.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;WARNING: We strongly recommend providing the MeiliSearch public key in a production environment, which is enough to perform search requests.&lt;br&gt;
Read more about &lt;a href="https://docs.meilisearch.com/reference/features/authentication.html"&gt;MeiliSearch authentication&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The default behavior of this library fits perfectly for a documentation search bar, but you might need &lt;a href="https://github.com/meilisearch/docs-searchbar.js#customization"&gt;some customizations&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For more concrete examples, you can check out this &lt;a href="https://github.com/meilisearch/docs-searchbar.js/blob/master/scripts/playground.html"&gt;basic HTML file&lt;/a&gt; or &lt;a href="https://github.com/meilisearch/vuepress-plugin-meilisearch/blob/master/MeiliSearchBox.vue"&gt;this more advanced Vue file&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  What's next?
&lt;/h1&gt;

&lt;p&gt;At this point you should have a working search engine on your website, congrats! 🎉&lt;br&gt;
You can check &lt;a href="https://docs.meilisearch.com/running-production/"&gt;this tutorial&lt;/a&gt; if you now want to run MeiliSearch in production!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>An alternative RubyGems search bar based on an opensource search engine</title>
      <dc:creator>curquiza</dc:creator>
      <pubDate>Thu, 30 Jan 2020 13:37:13 +0000</pubDate>
      <link>https://forem.com/meilisearch/an-alternative-rubygems-search-bar-base-on-an-opensource-search-engine-58j6</link>
      <guid>https://forem.com/meilisearch/an-alternative-rubygems-search-bar-base-on-an-opensource-search-engine-58j6</guid>
      <description>&lt;p&gt;As a Rails and Ruby lover, I often search for the gem that will perfectly cover my use case. When I need to solve a problem I'm having, I want to choose the right one, the most suitable solution.&lt;/p&gt;

&lt;p&gt;Ruby gems are extensive libraries created inside the Ruby community. The best place to find a ready solution for any task is the website rubygems.org, a public repository of gems that can be searched using the search box on the home page. RubyGems’ website is an efficient tool that facilitates the sharing and installation of packages. But although its search bar is very helpful, I decided to create an &lt;a href="https://rubygems.meilisearch.com"&gt;alternative search bar&lt;/a&gt; more suited to our needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1yge7zufzdia6jx3gilm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1yge7zufzdia6jx3gilm.png" alt="Rubygems alternative search bar" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I made this project with &lt;a href="https://github.com/meilisearch/MeiliSearch"&gt;MeiliSearch&lt;/a&gt;, an opensource alternative to Algolia.&lt;/p&gt;

&lt;p&gt;The complete article is available &lt;a href="https://blog.meilisearch.com/meilisearch-finds-rubygems/"&gt;on our blog&lt;/a&gt;. I explain my approach in detail and how MeiliSearch works.&lt;/p&gt;

&lt;p&gt;Hope you will enjoy my first article! 😁&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>search</category>
      <category>webdev</category>
      <category>ruby</category>
    </item>
  </channel>
</rss>
