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] -> [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.

caution

Files stored in file fields (e.g., PDFs, Word documents) are not included as vector data conversion targets and will not be read by RAG. To make file content available for RAG, you need to extract the text from the file using a custom process and save it to a text-based field such as a textarea or WYSIWYG field.

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.

Checking the vector data generation status​

Vector data is generated by a batch process after content is saved. Right after content is added or updated, the updated content may not yet be reflected in vector search.

When you check vector_status in the advanced settings of a Topics::list or Topics::details endpoint, a vector_status object indicating the vector data generation status is added to each content item in the response.

"vector_status": {
"state": "pending",
"chunks_total": 2,
"chunks_done": 0,
"stale": false,
"updated_at": "2026-08-05T14:46:13+09:00"
}
ItemDescription
stateThe vector data generation status. See the table below for the values.
chunks_totalThe number of chunks stored for the content.
chunks_doneThe number of chunks in chunks_total that have stored vector data.
staletrue when the content, the [Keyword template(AI/Vector)] of the content structure, or its [Embedding model] was changed after the vector data was generated.
updated_atThe date and time the vector data of the content was last updated. null when no chunks are stored.

The values of state are as follows.

ValueDescription
disabledNo new vector data is generated for the content. This applies in any of the following cases:
  • [AI] in [AI] -> [Vector Data] is not enabled
  • [Convert to vector data] of the content structure is not enabled
  • The model selected in [Embedding model] of the content structure is not available on the site
  • The content structure or the content is private (unless [Send private contents] in [AI] -> [Vector Data] is enabled)
pendingWaiting for vector data generation.
processingVector data is being generated.
doneVector data is stored for all chunks.
failedVector data generation failed for at least one chunk, and it will not be retried.
tip

When state is done and stale is false, the content can be found by vector search with its current content. For example, an application can use this to show users when imported content is ready for vector search.

When you select a model in [Tree search] in [AI] -> [Vector Data], Topics::list searches with vector_search rerank the candidates that AI collects by walking the category tree together with the vector search candidates. The endpoint settings and the way you send requests do not change.
For the tree search setting, see Vector Data.

When tree search is used, the following fields are added or changed in the response.

FieldDescription
rag_answerableAdded directly under the response (at the same level as list and pageInfo). The probability (0 to 1) that any of the results answers the query. Not added when the search has no candidates (for example, when no content matches the filter).
rag_confidenceAdded to each content item. The probability that the content answers the query.
rag_chunkAdded to each content item when [Return the full article] of the content structure is disabled. The text of the section that answers the query. In this case, contents and pre_embedding_text of the primary language are also replaced with this section.
vector_distanceA value based on the rank, not the vector distance.

When rag_answerable is below answerable_threshold (default 0.2) in the advanced settings of the endpoint, list returns no results. Specify 0 for answerable_threshold to disable this check. max_distance is not applied to tree search.

On sites where [Send private contents] in [AI] -> [Vector Data] is disabled, content structures that are private or have viewing restrictions are excluded from tree search, and the search runs on the remaining content structures.

note

In the following cases, tree search is not run and only the vector search results are returned.

  • The API key required for the selected model is not registered
  • The model does not respond
  • [Send private contents] is disabled and all the searched content structures are private or have viewing restrictions
  • [Send private contents] is disabled and the vector search candidates include content from a content structure excluded from tree search

Support

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