1"use strict";(self.webpackChunkkurokuro=self.webpackChunkkurokuro||[]).push([["12194"],{79180:function(e,t,n){n.r(t),n.d(t,{metadata:()=>i,default:()=>h,frontMatter:()=>s,contentTitle:()=>o,toc:()=>l,assets:()=>c});var i=JSON.parse('{"id":"tutorials/how-to-implement-vector-search","title":"Prepare a Vector Template for Fuzzy Search","description":"By converting content into vector data, you can implement fuzzy search. By using the vector distance between search keywords and vectorized content, the content is responded in order of relevance.","source":"@site/docs/tutorials/how-to-implement-vector-search.md","sourceDirName":"tutorials","slug":"/tutorials/how-to-implement-vector-search","permalink":"/docs/tutorials/how-to-implement-vector-search","draft":false,"unlisted":false,"editUrl":"https://github.com/diverta/kuroco-documents/tree/main/packages/create-docusaurus/templates/shared/docs/tutorials/how-to-implement-vector-search.md","tags":[],"version":"current","frontMatter":{"title":"Prepare a Vector Template for Fuzzy Search","description":"By converting content into vector data, you can implement fuzzy search. By using the vector distance between search keywords and vectorized content, the content is responded in order of relevance."},"sidebar":"documentationSidebar","previous":{"title":"Generating AI Responses","permalink":"/docs/tutorials/generating-ai-responses"},"next":{"title":"Setting up Kuroco RAG","permalink":"/docs/tutorials/setting-up-kurocorag"}}'),r=n(74848),a=n(28453);let s={title:"Prepare a Vector Template for Fuzzy Search",description:"By converting content into vector data, you can implement fuzzy search. By using the vector distance between search keywords and vectorized content, the content is responded in order of relevance."},o,c={},l=[{value:"Overview",id:"overview",level:2},{value:"What You Will Learn",id:"what-you-will-learn",level:3},{value:"Prepare the Content",id:"prepare-the-content",level:2},{value:"Enabling AI",id:"enabling-ai",level:3},{value:"Creating the Content Structure",id:"creating-the-content-structure",level:4},{value:"Set Up the Vector Template",id:"set-up-the-vector-template",level:2},{value:"Template Verification",id:"template-verification",level:3},{value:"Modifying the Template",id:"modifying-the-template",level:3},{value:"Reference",id:"reference",level:4},{value:"Confirming the operation",id:"confirming-the-operation",level:2},{value:"Adding the contents",id:"adding-the-contents",level:4},{value:"Checking the vector template",id:"checking-the-vector-template",level:3},{value:"Preparing the vector search endpoint",id:"preparing-the-vector-search-endpoint",level:3},{value:"Checking in Swagger UI",id:"checking-in-swagger-ui",level:3},{value:"Related Documents",id:"related-documents",level:2}];function d(e){let t={a:"a",admonition:"admonition",br:"br",code:"code",h2:"h2",h3:"h3",h4:"h4",img:"img",li:"li",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"overview",children:"Overview"}),"\n",(0,r.jsxs)(t.p,{children:["By converting content into vector data, you can implement fuzzy search.",(0,r.jsx)(t.br,{}),"\nBy utilizing the vector distance between search keywords and vectorized content, the content is responded in order of relevance."]}),"\n",(0,r.jsx)(t.p,{children:"This enables searches with variations in words used or searches based on text."}),"\n",(0,r.jsx)(t.p,{children:"This document demonstrates fuzzy search on internal documents registered as content."}),"\n",(0,r.jsx)(t.h3,{id:"what-you-will-learn",children:"What You Will Learn"}),"\n",(0,r.jsx)(t.p,{children:"You will set up and verify the vector template using the following steps."}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"#prepare-the-content",children:"Prepare the Content"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"#set-up-the-vector-template",children:"Set Up the Vector Template"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"#confirming-the-operation",children:"Confirming the operation"})}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"prepare-the-content",children:"Prepare the Content"}),"\n",(0,r.jsx)(t.h3,{id:"enabling-ai",children:"Enabling AI"}),"\n",(0,r.jsx)(t.p,{children:"Click on [AI] -> [Vector Data]."}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/6430fa5fa0be635c8a6286318a18299c.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/6430fa5fa0be635c8a6286318a18299c.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.p,{children:'Enable "AI" and click [Update].'}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/99436d8e4cf6503de7e4b73f91ada074.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/99436d8e4cf6503de7e4b73f91ada074.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.h4,{id:"creating-the-content-structure",children:"Creating the Content Structure"}),"\n",(0,r.jsxs)(t.p,{children:["Register the content structure that will be the target for vector search.",(0,r.jsx)(t.br,{}),"\nClick [Add] on the ",(0,r.jsx)(t.a,{href:"/docs/management/content-structure-topics-group/",children:"Content structure list"})," page."]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/4523beb172cc12344cb8b7fba6757d29.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/4523beb172cc12344cb8b7fba6757d29.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.p,{children:"Configure with the following details."}),"\n",(0,r.jsx)(t.p,{children:"Configure the settings with the following details."}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.strong,{children:"General"})}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Field"}),(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Setting"})]})}),(0,r.jsx)(t.tbody,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Name"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Internal Documents"})]})})]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/939bb923b2571add296cf3cf954582f5.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/939bb923b2571add296cf3cf954582f5.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.strong,{children:"Field Settings"})}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Field"}),(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Slug"}),(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Field Name"}),(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Field Setting"})]})}),(0,r.jsx)(t.tbody,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"ext_1"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"None"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"WYSIWYG"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"WYSIWYG"})]})})]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/2174758b65dfbb6803ab406987aa4665.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/2174758b65dfbb6803ab406987aa4665.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.strong,{children:"Search Settings"})}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Field"}),(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Setting"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Convert to vector data"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Enable"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Embedding model"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"text-embedding-3-small(OpenAI)"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Keyword template (AI/Vector)"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Default"})]})]})]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/38a8b9d96b711e44369e8c03bd951c44.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/38a8b9d96b711e44369e8c03bd951c44.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.p,{children:"Once the settings are done, click on [Add] to add the content structure."}),"\n",(0,r.jsx)(t.h2,{id:"set-up-the-vector-template",children:"Set Up the Vector Template"}),"\n",(0,r.jsx)(t.h3,{id:"template-verification",children:"Template Verification"}),"\n",(0,r.jsx)(t.p,{children:"By default, the following templates are entered as conversion targets for vector data."}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"topics_id"}),"\n",(0,r.jsx)(t.li,{children:"slug"}),"\n",(0,r.jsx)(t.li,{children:"Title"}),"\n",(0,r.jsx)(t.li,{children:"Content"}),"\n",(0,r.jsx)(t.li,{children:"Category"}),"\n",(0,r.jsx)(t.li,{children:"Text part of all extension items"}),"\n"]}),"\n",(0,r.jsx)(t.admonition,{type:"info",children:(0,r.jsx)(t.p,{children:"If you want to revert to the initial state, leaving it empty will automatically input the default template."})}),"\n",(0,r.jsx)(t.admonition,{type:"caution",children:(0,r.jsx)(t.p,{children:"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.\nTo 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."})}),"\n",(0,r.jsx)(t.h3,{id:"modifying-the-template",children:"Modifying the Template"}),"\n",(0,r.jsx)(t.p,{children:"If you want to exclude specific items from the template or add related member information to the template, you can modify the template."}),"\n",(0,r.jsx)(t.p,{children:"For this tutorial, we will proceed with the default settings."}),"\n",(0,r.jsx)(t.h4,{id:"reference",children:"Reference"}),"\n",(0,r.jsx)(t.p,{children:"The available variables are as follows."}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Variable"}),(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Type"}),(0,r.jsx)(t.th,{style:{textAlign:"left"},children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"$details"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Object"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Content details"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"$ext_config"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Object"}),(0,r.jsx)(t.td,{style:{textAlign:"left"},children:"Content extension settings"})]})]})]}),"\n",(0,r.jsx)(t.p,{children:"The text output by Smarty notation becomes the vector template."}),"\n",(0,r.jsxs)(t.admonition,{type:"info",children:[(0,r.jsx)(t.p,{children:"Please refer to the following document for examples of modifications."}),(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/tutorials/how-to-implement-cutom-body-search/#modifying-the-search-target-string-template",children:"Prepare a keyword search string"})}),"\n"]})]}),"\n",(0,r.jsx)(t.h2,{id:"confirming-the-operation",children:"Confirming the operation"}),"\n",(0,r.jsx)(t.p,{children:"Add content and check the search results from Swagger UI."}),"\n",(0,r.jsx)(t.h4,{id:"adding-the-contents",children:"Adding the contents"}),"\n",(0,r.jsxs)(t.p,{children:["Click on [Add] from the ",(0,r.jsx)(t.a,{href:"/docs/management/content-structure-topics/",children:"Content list"})," screen.\n",(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/51445295b38439dc7b77b28c7d2e9774.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/51445295b38439dc7b77b28c7d2e9774.png",alt:"Image from Gyazo"})]}),"\n",(0,r.jsx)(t.p,{children:"Here, we have added the following 3 contents as examples."}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.strong,{children:"Remote Work Guidelines"}),"\n",(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/6705d2b56b4f3d0e4f6c082415f22e52.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/6705d2b56b4f3d0e4f6c082415f22e52.png",alt:"Image from Gyazo"})]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.strong,{children:"Employee Benefits Guidebook"}),"\n",(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/f4d54c1d451b8789b3f3a44a539ed9d0.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/f4d54c1d451b8789b3f3a44a539ed9d0.png",alt:"Image from Gyazo"})]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.strong,{children:"Contact Information"}),"\n",(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/899e1315b
11ee4c0cf532dcd61b80d379.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/899e1315b1ee4c0cf532dcd61b80d379.png",alt:"Image from Gyazo"})]}),"\n",(0,r.jsx)(t.h3,{id:"checking-the-vector-template",children:"Checking the vector template"}),"\n",(0,r.jsxs)(t.p,{children:["In the editing screen of the added content, click the [More] button to display options.",(0,r.jsx)(t.br,{}),"\nBy clicking on [Vector Template], you can check the output template."]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/1a7911ecba158bcc39eaa79cef9038d4.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/1a7911ecba158bcc39eaa79cef9038d4.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.admonition,{type:"caution",children:(0,r.jsx)(t.p,{children:"The option for [Vector Template] will not be displayed until the reflection is complete."})}),"\n",(0,r.jsx)(t.p,{children:"You can check the template, summary, and index."}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/0a462d4f95b39b1cc3a51350f26cecbe.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/0a462d4f95b39b1cc3a51350f26cecbe.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.h3,{id:"preparing-the-vector-search-endpoint",children:"Preparing the vector search endpoint"}),"\n",(0,r.jsxs)(t.p,{children:["Refer to the ",(0,r.jsx)(t.a,{href:"/docs/tutorials/configure-endpoint/",children:"Endpoint Configuration Guide"})," to create a vector search endpoint."]}),"\n",(0,r.jsx)(t.p,{children:"Set the path and model as follows:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"Path: vector_search"}),"\n",(0,r.jsx)(t.li,{children:"Category: Content"}),"\n",(0,r.jsx)(t.li,{children:"Model: Topics, v1"}),"\n",(0,r.jsx)(t.li,{children:"Operation: list"}),"\n",(0,r.jsxs)(t.li,{children:["topics_group_id: 42 (ID assigned in ",(0,r.jsx)(t.a,{href:"#creating-the-content-structure",children:"Creating the content structure"}),")"]}),"\n"]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/adee6ee2a45339aee75b375c12a8cf40.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/adee6ee2a45339aee75b375c12a8cf40.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.h3,{id:"checking-in-swagger-ui",children:"Checking in Swagger UI"}),"\n",(0,r.jsxs)(t.p,{children:["Request the endpoint added with [Preparing the vector search endpoint] from the Swagger UI screen.",(0,r.jsx)(t.br,{}),"\nEnter ",(0,r.jsx)(t.code,{children:"Work from home"})," in the vector_search field and click Execute."]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/44108354f4a966583b410b15f0f4b210.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/44108354f4a966583b410b15f0f4b210.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsxs)(t.p,{children:["Although the term ",(0,r.jsx)(t.code,{children:"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."]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://t.gyazo.com/teams/diverta/8d0456db83228fdc4f66ca71339d8b94.png?width=600","data-zoom-src":"https://t.gyazo.com/teams/diverta/8d0456db83228fdc4f66ca71339d8b94.png",alt:"Image from Gyazo"})}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsx)(t.p,{children:"The vector_distance field represents the vector distance from the search string, and will be responded in ascending order of small values."})}),"\n",(0,r.jsx)(t.h2,{id:"related-documents",children:"Related Documents"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/tutorials/adding-a-topics/",children:"Creating content structure"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/management/extra-information/",children:"Extended item settings"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/tutorials/configure-endpoint/",children:"Configuring endpoints"})}),"\n"]})]})}function h(e={}){let{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},28453:function(e,t,n){n.d(t,{R:()=>s,x:()=>o});var i=n(96540);let r={},a=i.createContext(r);function s(e){let t=i.useContext(a);return i.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),i.createElement(a.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.