{"id":19245,"date":"2025-01-24T12:48:05","date_gmt":"2025-01-24T04:48:05","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=19245"},"modified":"2025-07-14T09:40:11","modified_gmt":"2025-07-14T01:40:11","slug":"orama","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/pt\/orama\/","title":{"rendered":"Orama\uff1a\u9ad8\u6027\u80fd\u5168\u6587\u672c\u548c\u5411\u91cf\u641c\u7d22\u5f15\u64ce"},"content":{"rendered":"<p>Orama \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u9ad8\u6027\u80fd\u641c\u7d22\u5f15\u64ce\uff0c\u5b8c\u5168\u7528 TypeScript \u7f16\u5199\uff0c\u652f\u6301\u5168\u6587\u672c\u641c\u7d22\u3001\u5411\u91cf\u641c\u7d22\u548c\u6df7\u5408\u641c\u7d22\u3002Orama \u65e8\u5728\u5728\u4efb\u4f55 JavaScript \u8fd0\u884c\u65f6\u73af\u5883\u4e2d\u5de5\u4f5c\uff0c\u63d0\u4f9b\u5feb\u901f\u3001\u53ef\u9760\u7684\u641c\u7d22\u529f\u80fd\u3002\u5b83\u7684\u8bbe\u8ba1\u76ee\u6807\u662f\u8f7b\u91cf\u7ea7\uff08\u5c0f\u4e8e2KB\uff09\uff0c\u4f46\u529f\u80fd\u5f3a\u5927\uff0c\u9002\u7528\u4e8e\u5404\u79cd\u5e94\u7528\u573a\u666f\uff0c\u5305\u62ec\u6d4f\u89c8\u5668\u3001\u670d\u52a1\u5668\u548c\u8fb9\u7f18\u7f51\u7edc\u3002Orama \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u5982\u5168\u6587\u672c\u641c\u7d22\u3001\u5411\u91cf\u641c\u7d22\u3001\u6df7\u5408\u641c\u7d22\u3001\u5730\u7406\u641c\u7d22\u3001\u62fc\u5199\u5bb9\u9519\u548c\u591a\u8bed\u8a00\u652f\u6301\u7b49\uff0c\u80fd\u591f\u6ee1\u8db3\u4ece\u5c0f\u578b\u9879\u76ee\u5230\u5927\u578b\u4f01\u4e1a\u5e94\u7528\u7684\u5404\u79cd\u641c\u7d22\u9700\u6c42\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-19246\" title=\"Orama\uff1a\u9ad8\u6027\u80fd\u5168\u6587\u672c\u548c\u5411\u91cf\u641c\u7d22\u5f15\u64ce-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/30eb849d83b71cd.png\" alt=\"Orama\uff1a\u9ad8\u6027\u80fd\u5168\u6587\u672c\u548c\u5411\u91cf\u641c\u7d22\u5f15\u64ce-1\" width=\"831\" height=\"626\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/30eb849d83b71cd.png 831w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/30eb849d83b71cd-300x226.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/30eb849d83b71cd-768x579.png 768w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/01\/30eb849d83b71cd-16x12.png 16w\" sizes=\"auto, (max-width: 831px) 100vw, 831px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li><strong>\u5168\u6587\u672c\u641c\u7d22<\/strong>\uff1a\u652f\u6301\u5bf9\u6587\u672c\u5185\u5bb9\u8fdb\u884c\u5feb\u901f\u3001\u51c6\u786e\u7684\u5168\u6587\u641c\u7d22\u3002<\/li>\n<li><strong>\u5411\u91cf\u641c\u7d22<\/strong>\uff1a\u652f\u6301\u57fa\u4e8e\u5411\u91cf\u7684\u641c\u7d22\uff0c\u9002\u7528\u4e8e\u56fe\u50cf\u3001\u97f3\u9891\u7b49\u975e\u6587\u672c\u6570\u636e\u7684\u641c\u7d22\u3002<\/li>\n<li><strong>\u6df7\u5408\u641c\u7d22<\/strong>\uff1a\u7ed3\u5408\u5168\u6587\u672c\u548c\u5411\u91cf\u641c\u7d22\uff0c\u63d0\u4f9b\u66f4\u5168\u9762\u7684\u641c\u7d22\u7ed3\u679c\u3002<\/li>\n<li><strong>\u9ad8\u6027\u80fd<\/strong>\uff1a\u4f18\u5316\u7684\u641c\u7d22\u7b97\u6cd5\uff0c\u786e\u4fdd\u5728\u5927\u6570\u636e\u91cf\u4e0b\u4ecd\u80fd\u5feb\u901f\u54cd\u5e94\u3002<\/li>\n<li><strong>\u5f00\u6e90<\/strong>\uff1a\u5b8c\u5168\u5f00\u6e90\uff0c\u5141\u8bb8\u7528\u6237\u6839\u636e\u9700\u8981\u8fdb\u884c\u5b9a\u5236\u548c\u6269\u5c55\u3002<\/li>\n<li><strong>\u65e0\u4f9d\u8d56<\/strong>\uff1a\u65e0\u9700\u4efb\u4f55\u5916\u90e8\u4f9d\u8d56\uff0c\u7b80\u5316\u4e86\u5b89\u88c5\u548c\u4f7f\u7528\u8fc7\u7a0b\u3002<\/li>\n<li><strong>\u591a\u5e73\u53f0\u652f\u6301<\/strong>\uff1a\u517c\u5bb9\u5404\u79cd JavaScript \u8fd0\u884c\u65f6\u73af\u5883\uff0c\u5305\u62ec Node.js \u548c\u6d4f\u89c8\u5668\u3002<\/li>\n<li><strong>\u5730\u7406\u641c\u7d22<\/strong>\uff1a\u652f\u6301\u57fa\u4e8e\u5730\u7406\u4f4d\u7f6e\u7684\u641c\u7d22\u529f\u80fd\u3002<\/li>\n<li><strong>\u62fc\u5199\u5bb9\u9519<\/strong>\uff1a\u63d0\u4f9b\u62fc\u5199\u9519\u8bef\u5bb9\u5fcd\u5ea6\uff0c\u63d0\u5347\u641c\u7d22\u4f53\u9a8c\u3002<\/li>\n<li><strong>\u591a\u8bed\u8a00\u652f\u6301<\/strong>\uff1a\u652f\u630130\u79cd\u8bed\u8a00\u7684\u8bcd\u5e72\u63d0\u53d6\u548c\u6807\u8bb0\u5316\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>\u5b89\u88c5<\/h3>\n<p>Orama \u53ef\u4ee5\u901a\u8fc7 npm\u3001yarn \u6216 pnpm \u5b89\u88c5\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528 npm \u5b89\u88c5\u7684\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u5de5\u5177\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 Orama\uff1a<\/li>\n<\/ol>\n<pre><code>   npm install @orama\/orama\r\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u5728\u9879\u76ee\u4e2d\u5f15\u5165 Orama\uff1a<\/li>\n<\/ol>\n<pre><code>   import { create, insert, search } from '@orama\/orama';\r\n<\/code><\/pre>\n<h3>\u4f7f\u7528<\/h3>\n<h4>\u521b\u5efa\u7d22\u5f15<\/h4>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7d22\u5f15\uff1a<\/li>\n<\/ol>\n<pre><code>   const db = create({\r\nschema: {\r\nname: 'string',\r\ndescription: 'string',\r\nprice: 'number',\r\nembedding: 'vector[1536]',\r\nmeta: {\r\nrating: 'number',\r\n},\r\n},\r\n});\r\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u6dfb\u52a0\u6587\u6863\u5230\u7d22\u5f15\uff1a<\/li>\n<\/ol>\n<pre><code>   insert(db, {\r\nname: 'Noise cancelling headphones',\r\ndescription: 'Best noise cancelling headphones on the market',\r\nprice: 99.99,\r\nembedding: [0.2432, 0.9431, 0.5322, 0.4234, ...],\r\nmeta: { rating: 4.5 },\r\n});\r\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u6267\u884c\u641c\u7d22\uff1a<\/li>\n<\/ol>\n<pre><code>   const results = search(db, { term: 'Best headphones' });\r\nconsole.log(results);\r\n<\/code><\/pre>\n<h4>\u5411\u91cf\u641c\u7d22<\/h4>\n<ol>\n<li>\u521b\u5efa\u5411\u91cf\u7d22\u5f15\uff1a<\/li>\n<\/ol>\n<pre><code>   const vectorIndex = create({\r\nschema: {\r\nname: 'string',\r\nembedding: 'vector[1536]',\r\n},\r\n});\r\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u6dfb\u52a0\u5411\u91cf\u5230\u7d22\u5f15\uff1a<\/li>\n<\/ol>\n<pre><code>   insert(vectorIndex, {\r\nname: 'Sample vector',\r\nembedding: [0.1, 0.2, 0.3, ...],\r\n});\r\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u6267\u884c\u5411\u91cf\u641c\u7d22\uff1a<\/li>\n<\/ol>\n<pre><code>   const vectorResults = search(vectorIndex, {\r\nterm: 'Sample vector',\r\nmode: 'vector',\r\n});\r\nconsole.log(vectorResults);\r\n<\/code><\/pre>\n<h3>\u9ad8\u7ea7\u529f\u80fd<\/h3>\n<p>Orama \u8fd8\u63d0\u4f9b\u4e86\u8bb8\u591a\u9ad8\u7ea7\u529f\u80fd\uff0c\u5982\u81ea\u5b9a\u4e49\u6570\u636e\u5bfc\u5165\u3001\u8d28\u91cf\u68c0\u67e5\u3001\u5206\u6790\u5de5\u5177\u548c\u5b89\u5168\u914d\u7f6e\u7b49\u3002\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u914d\u7f6e\uff0c\u4ee5\u4f18\u5316\u641c\u7d22\u4f53\u9a8c\u3002<\/p>\n<h3>\u793a\u4f8b\u9879\u76ee<\/h3>\n<p>Orama \u5df2\u88ab\u591a\u4e2a\u77e5\u540d\u7f51\u7ad9\u4f7f\u7528\uff0c\u5982 nodejs.org\u3001jsr.io \u548c tanstack.com\u3002\u8fd9\u4e9b\u7f51\u7ad9\u6bcf\u5929\u5904\u7406\u6570\u767e\u4e07\u6b21\u67e5\u8be2\uff0c\u5c55\u793a\u4e86 Orama \u7684\u5f3a\u5927\u6027\u80fd\u548c\u53ef\u9760\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Orama \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u9ad8\u6027\u80fd\u641c\u7d22\u5f15\u64ce\uff0c\u5b8c\u5168\u7528 TypeScript \u7f16\u5199\uff0c\u652f\u6301\u5168\u6587\u672c\u641c\u7d22\u3001\u5411\u91cf\u641c\u7d22\u548c\u6df7\u5408\u641c\u7d22\u3002Orama \u65e8\u5728\u5728\u4efb\u4f55 JavaScript \u8fd0\u884c\u65f6\u73af\u5883\u4e2d\u5de5\u4f5c\uff0c\u63d0\u4f9b\u5feb\u901f\u3001\u53ef\u9760\u7684\u641c\u7d22\u529f\u80fd\u3002\u5b83\u7684\u8bbe\u8ba1\u76ee\u6807\u662f\u8f7b\u91cf\u7ea7\uff08\u5c0f\u4e8e2KB\uff09\uff0c\u4f46&#8230;<\/p>\n","protected":false},"author":1,"featured_media":61708,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[425,20,459],"tags":[230,243],"class_list":["post-19245","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-professional","category-tool","category-rag-project","tag-aikaiyuanxiangmu","tag-aizhishikuyukefu"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/19245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/comments?post=19245"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/posts\/19245\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media\/61708"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/media?parent=19245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/categories?post=19245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/pt\/wp-json\/wp\/v2\/tags?post=19245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}