Skip to main content

Prepare a Vector Template for Fuzzy Search

Overview

By converting content into vector data, you can implement fuzzy search.
By utilizing the vector distance between search keywords and vectorized content, the content is responded in order of relevance.

This enables searches with variations in words used or searches based on text.

This document demonstrates fuzzy search on internal documents registered as content.

What You Will Learn

You will set up and verify the vector template using the following steps.

Prepare the Content

Enabling AI

Click on [AI/RAG] -> [Vector Data].

Image from Gyazo

Enable "AI" and click [Update].

Image from Gyazo

Creating the Content Structure

Register the content structure that will be the target for vector search.
Click [Add] on the Content structure list page.

Image from Gyazo

Configure with the following details.

Configure the settings with the following details.

General

FieldSetting
NameInternal Documents

Image from Gyazo

Field Settings

FieldSlugField NameField Setting
ext_1NoneWYSIWYGWYSIWYG

Image from Gyazo

Search Settings

FieldSetting
Convert to vector dataEnable
Embedding modeltext-embedding-3-small(OpenAI)
Keyword template (AI/Vector)Default

Image from Gyazo

Once the settings are done, click on [Add] to add the content structure.

Set Up the Vector Template

Template Verification

By default, the following templates are entered as conversion targets for vector data.

  • topics_id
  • slug
  • Title
  • Content
  • Category
  • Text part of all extension items
info

If you want to revert to the initial state, leaving it empty will automatically input the default template.

Modifying the Template

If you want to exclude specific items from the template or add related member information to the template, you can modify the template.

For this tutorial, we will proceed with the default settings.

Reference

The available variables are as follows.

VariableTypeDescription
$detailsObjectContent details
$ext_configObjectContent extension settings

The text output by Smarty notation becomes the vector template.

info

Please refer to the following document for examples of modifications.

Confirming the operation

Add content and check the search results from Swagger UI.

Adding the contents

Click on [Add] from the Content list screen. Image from Gyazo

Here, we have added the following 3 contents as examples.

Remote Work Guidelines Image from Gyazo

Employee Benefits Guidebook Image from Gyazo

Contact Information Image from Gyazo

Checking the vector template

In the editing screen of the added content, click the [More] button to display options.
By clicking on [Vector Template], you can check the output template.

Image from Gyazo

caution

The option for [Vector Template] will not be displayed until the reflection is complete.

You can check the template, summary, and index.

Image from Gyazo

Preparing the vector search endpoint

Refer to the Endpoint Configuration Guide to create a vector search endpoint.

Set the path and model as follows:

Image from Gyazo

Checking in Swagger UI

Request the endpoint added with [Preparing the vector search endpoint] from the Swagger UI screen.
Enter Work from home in the vector_search field and click Execute.

Image from Gyazo

Although the term Work from home is not registered in the content, the document related to Remote Work Guidelines with high relevance will be listed first in the response.

Image from Gyazo

tip

The vector_distance field represents the vector distance from the search string, and will be responded in ascending order of small values.


Support

If you have any other questions, please contact us or check out Our Slack Community.