Search your data with AI (vector search)

Edited

Vector search represents the next generation of search technology. Unlike traditional keyword-based search, vector search uses artificial intelligence to understand the meaning of a query.

Technically, this works by converting words into numerical vectors that represent their meaning in a high-dimensional space. This makes it possible to find results by calculating the semantic similarity between the query and the datasets on your domain. You can think of it like a cloud, where the more similar the droplets of water are the closer they are to each other.

This powerful technology offers an alternative to how we traditionally search for datasets, by providing a wider range of relevant results, even when the exact keywords are not used in the query.

Each dataset publication triggers an automatic indexing process. This process meticulously catalogs the dataset's metadata (so note, not the data itself):

  • Title

  • Description

  • Keywords

  • Themes (dataset categories)

  • Territory (countries, regions, departments, municipalities, etc.)

A reminder: Always fill out the metadata on your datasets!

Vector vs. traditional search

It's important to understand the difference between the traditional keyword-based search method and the new vector search method. One isn't necessarily better than the other; they search differently.

Vector search can be especially useful when you want to cast a wide net. Maybe you're not sure what exactly you're looking for, or you're not sure what form it will be in. The downside is that it may return incorrect results—it's more creative, but also imprecise.

As with other generative AI tools, a search made with a question or a phrase will be more effective than a single word. To get the best results, don't hesitate to be detailed.

Traditional searches are best when you're searching for something specific, and you know how to refer to that thing. If the term you searched for is not there, you'll get no results. So the downside of traditional search is that it's rigorous—while its results are precise, they're also unforgiving.

As such, note that even once you've set up vector search in your header, the search in your portal's sidebar (under "Filters") still uses the traditional search method.

Setting up vector search

The new search can be added to your header and to pages created in the Code editor.

In the header

Integrating vector searching into your site's header is a straightforward process. To begin, you'll need to add the search button to your header's menu (Portal > Style, then select the Header tab) by adding the placeholder ##quick-find## to your header HTML code.

See it placed in the example below, in bold:

##skip-to-content-link##
<nav class="ods-front-header" ods-responsive-menu breakpoint="1000">
    <ods-responsive-menu-placeholder>
        <a class="ods-front-header__portal-brand" href="/"> ##logo## </a>
    </ods-responsive-menu-placeholder>
    <ods-responsive-menu-collapsible>
        ##language##
        <a class="ods-front-header__portal-brand" href="/">
            ##logo##
            ##brand##
        </a>
        ##menu##
        ##quick-find##
        ##secondary-menu##
    </ods-responsive-menu-collapsible>
</nav>

Note that if you have a customized header, vector search may disrupt its appearance. If you need help, don't hesitate to reach out to our support or your customer success contact.

On a Code editor page

For pages created using the Code editor, embedding the search bar is seamless with the use of the ods-catalog-search widget. Here's an example:

Step 1: Add the code snippet to the HTML code of the page

<ods-catalog-search
    class-name="'my-search-box'"
    label="'your-label-here'">
</ods-catalog-search>

For this widget, two parameters are available:

  • class-name allows you to add a class to the search bar in order to customize it

  • label allows you to add a custom label to the search bar

Step 2: Add CSS to the widget

Paste this code at the end of the CSS file of the page, or in the dedicated section should you have any.

.my-search-box {
    text-align: left;
    z-index: 2;
}

If the page is available in multiple languages, remember to repeat this process for each language.

A quick tutorial

Click through the quick tutorial below, which will walk you through the process:

Keyboard shortcut

There is a keyboard shortcut for quick access to the search.

By clicking Ctrl + K on a PC or Cmd + K on a Mac, you can display the quick find window on any page of your portal.