{"id":6850,"date":"2026-05-06T17:10:25","date_gmt":"2026-05-06T09:10:25","guid":{"rendered":"https:\/\/www.babel.cc\/blog\/?p=6850"},"modified":"2026-05-06T17:10:25","modified_gmt":"2026-05-06T09:10:25","slug":"%e4%bc%81%e4%b8%9a%e4%ba%91%e7%9b%98%e6%90%9c%e7%b4%a2%e6%8a%80%e6%9c%af%e6%bc%94%e8%bf%9b%ef%bc%9a%e4%bb%8e%e5%85%b3%e9%94%ae%e8%af%8d%e5%8c%b9%e9%85%8d%e5%88%b0%e8%af%ad%e4%b9%89%e7%90%86%e8%a7%a3-2","status":"publish","type":"post","link":"https:\/\/www.babel.cc\/blog\/?p=6850","title":{"rendered":"\u4f01\u4e1a\u4e91\u76d8\u641c\u7d22\u6280\u672f\u6f14\u8fdb\uff1a\u4ece\u5173\u952e\u8bcd\u5339\u914d\u5230\u8bed\u4e49\u7406\u89e3"},"content":{"rendered":"<p>&#8212;<br \/>\nplatform: wp<br \/>\narticle_id: WP-014<br \/>\ntitle: \u4f01\u4e1a\u4e91\u76d8\u641c\u7d22\u6280\u672f\u6f14\u8fdb\uff1a\u4ece\u5173\u952e\u8bcd\u5339\u914d\u5230\u8bed\u4e49\u7406\u89e3\u7684\u5b8c\u6574\u5b9e\u8df5<br \/>\ncreated_at: 2026-05-06<br \/>\ntags: [\u4f01\u4e1a\u4e91\u76d8, \u5168\u6587\u68c0\u7d22, Elasticsearch, \u8bed\u4e49\u641c\u7d22, AI\u641c\u7d22, MeiliSearch]<br \/>\n&#8212;<\/p>\n<p><h1><\/h1>\n<\/p>\n<p>\u4e0a\u5468\u4e94\u665a\u4e0a\u5341\u70b9\uff0c\u63a5\u5230\u4e00\u4e2a\u5ba2\u6237\u7535\u8bdd\uff0c\u5f20\u53e3\u5c31\u95ee\uff1a&#8221;\u4f60\u4eec\u8fd9\u4e2a\u4e91\u76d8\uff0c\u641c\u7d22\u529f\u80fd\u662f\u4e0d\u662f\u6709\u6bdb\u75c5\uff1f&#8221;<\/p>\n<p>\u6211\u6123\u4e86\u4e00\u4e0b\uff0c\u95ee\u600e\u4e48\u56de\u4e8b\u3002\u4ed6\u8bf4\u6709\u4e2a\u9879\u76ee\u6587\u4ef6\u660e\u660e\u5b58\u5728\uff0c\u6587\u4ef6\u540d\u91cc\u6709&#8221;\u7ec8\u7248&#8221;\u4e24\u4e2a\u5b57\uff0c\u641c&#8221;\u7ec8\u7248&#8221;\u627e\u4e0d\u5230\uff0c\u641c&#8221;\u6700\u7ec8\u7248&#8221;\u4e5f\u627e\u4e0d\u5230\uff0c\u641c&#8221;final&#8221;\u66f4\u627e\u4e0d\u5230\u3002\u6700\u540e\u53d1\u73b0\u662f\u6587\u4ef6\u540d\u91cc\u6709\u5168\u89d2\u5b57\u7b26&#8221;\u7ec8\u7248\u3000&#8221;\uff0c\u4e2d\u95f4\u6709\u4e2a\u7a7a\u683c\uff0c\u4f46\u90a3\u4e2a\u7a7a\u683c\u4e0d\u662f\u666e\u901a\u7a7a\u683c\u800c\u662f\u5168\u89d2\u7684\u3002<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u8ba9\u6211\u601d\u8003\u4e86\u5f88\u4e45\u3002<strong><\/strong> \u4eca\u5929\u628a\u6211\u8fd9\u51e0\u5e74\u8d9f\u8fc7\u7684\u8def\u5199\u51fa\u6765\uff0c\u4ece\u6700\u539f\u59cb\u7684SQL LIKE\u5230\u8bed\u4e49\u641c\u7d22\uff0c\u8bb2\u8bb2\u6bcf\u4e2a\u9636\u6bb5\u7684\u5751\u548c\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p><h2><\/h2>\n<\/p>\n<p>\u5148\u8bf4\u4e2a\u6570\u636e\u3002\u6211\u8c03\u7814\u8fc7\u51e0\u4e2a\u5ba2\u6237\uff0c\u5e73\u5747\u6bcf\u4e2a\u5458\u5de5\u6bcf\u5929\u5728\u4e91\u76d8\u91cc\u641c\u7d22\u6587\u4ef6\u7684\u6b21\u6570\u662f12\u6b21\u3002\u8fd9\u4e2a\u6570\u5b57\u6bd4\u4e3b\u52a8\u6d4f\u89c8\u6587\u4ef6\u5939\u7684\u6b21\u6570\u8fd8\u9ad8\u3002<\/p>\n<p>\u539f\u56e0\u662f\u4f01\u4e1a\u4e91\u76d8\u7684\u6587\u4ef6\u592a\u591a\u4e86\u3002\u4e00\u4e2a300\u4eba\u7684\u8bbe\u8ba1\u516c\u53f8\uff0c\u4e91\u76d8\u91cc\u5b58\u4e2a\u51e0\u767e\u4e07\u4e2a\u6587\u4ef6\u4e0d\u7a00\u5947\u3002\u9760\u624b\u5de5\u5728\u6587\u4ef6\u5939\u91cc\u7ffb\uff0c\u6839\u672c\u4e0d\u53ef\u80fd\u3002\u641c\u7d22\u662f\u627e\u5230\u6587\u4ef6\u7684\u552f\u4e00\u9760\u8c31\u65b9\u5f0f\u3002<\/p>\n<p>\u4f46\u641c\u7d22\u4f53\u9a8c\u5dee\uff0c\u7528\u6237\u5c31\u4f1a\u62b1\u6028&#8221;\u4e91\u76d8\u4e0d\u597d\u7528&#8221;\u3002\u4e0d\u597d\u7528\u5c31\u4e0d\u613f\u610f\u7528\uff0c\u4e0d\u613f\u610f\u7528\u5c31\u5bfc\u81f4\u6587\u4ef6\u6563\u843d\u5728\u5404\u5904\u6ca1\u4eba\u7ba1\uff0c\u6587\u4ef6\u7ba1\u7406\u5f7b\u5e95\u5931\u63a7\u3002\u6240\u4ee5\u641c\u7d22\u4f53\u9a8c\u76f4\u63a5\u5f71\u54cd\u6574\u4e2a\u4e91\u76d8\u7684\u4f7f\u7528\u7387\u3002<\/p>\n<p><h2><\/h2>\n<\/p>\n<p>\u6700\u65e9\u7684\u641c\u7d22\u65b9\u6848\uff0c\u6700\u7b80\u5355\u4e5f\u6700\u76f4\u63a5\uff1a\u6570\u636e\u5e93\u91cc\u5b58\u6587\u4ef6\u5143\u6570\u636e\uff08\u6587\u4ef6\u540d\u3001\u8def\u5f84\u3001\u521b\u5efa\u65f6\u95f4\u7b49\uff09\uff0c\u7528SQL\u7684LIKE\u8bed\u53e5\u67e5\u8be2\u3002<\/p>\n<p>&#8220;`sql<br \/>\nSELECT * FROM files<br \/>\nWHERE file_name LIKE &#8216;%\u5173\u952e\u8bcd%&#8217;<br \/>\nORDER BY updated_at DESC<br \/>\nLIMIT 100;<br \/>\n&#8220;`<\/p>\n<p>\u8fd9\u79cd\u65b9\u6848\u7684\u4f18\u70b9\u662f<strong><\/strong>\uff0c\u4e00\u4e2aSQL\u8bed\u53e5\u5c31\u641e\u5b9a\uff0cMySQL\u81ea\u5e26\u7684\u80fd\u529b\u3002\u7f3a\u70b9\u4e5f\u662f\u81f4\u547d\u7684\uff1a<\/p>\n<p><strong><\/strong><br \/>\n\u641c&#8221;\u9879\u76ee \u65b9\u6848&#8221;\uff08\u7a7a\u683c\u5206\u9694\uff09\uff0cLIKE &#8216;%\u9879\u76ee \u65b9\u6848%&#8217;\u53ea\u5339\u914d\u5305\u542b\u8fd9\u4e2a\u5b8c\u6574\u5b57\u7b26\u4e32\u7684\u7ed3\u679c\uff0c\u4e0d\u5339\u914d\u5305\u542b&#8221;\u9879\u76ee&#8221;\u548c&#8221;\u65b9\u6848&#8221;\u4e24\u4e2a\u8bcd\u4f46\u4e2d\u95f4\u6709\u5176\u4ed6\u5b57\u7b26\u7684\u60c5\u51b5\u3002<\/p>\n<p><strong><\/strong><br \/>\n\u641c&#8221;\u5408\u540c&#8221;\uff0c\u627e\u4e0d\u5230&#8221;\u534f\u8bae&#8221;\u3002\u641c&#8221;\u91c7\u8d2d&#8221;\uff0c\u627e\u4e0d\u5230&#8221;\u8d2d\u4e70&#8221;\u3002\u5728\u4f01\u4e1a\u573a\u666f\u91cc\uff0c\u540c\u4e00\u4e8b\u7269\u6709\u591a\u79cd\u53eb\u6cd5\u592a\u6b63\u5e38\u4e86\u3002<\/p>\n<p><strong><\/strong><br \/>\nLIKE &#8216;%xxx%&#8217;\u8fd9\u79cd\u5199\u6cd5\uff0c\u6570\u636e\u5e93\u6ca1\u6cd5\u7528\u7d22\u5f15\uff0c\u5fc5\u987b\u5168\u8868\u626b\u63cf\u3002\u6587\u4ef6\u6570\u91cf\u8d85\u8fc710\u4e07\u6761\uff0c\u641c\u7d22\u5c31\u5f00\u59cb\u5361\u4e86\u3002<\/p>\n<p><strong><\/strong><br \/>\n\u641c\u51fa\u6765\u7684\u7ed3\u679c\u6309\u66f4\u65b0\u65f6\u95f4\u6392\u5e8f\uff0c\u4e0d\u6309\u76f8\u5173\u5ea6\u6392\u5e8f\u3002\u7528\u6237\u8981\u627e\u7684&#8221;\u91c7\u8d2d\u5408\u540c\u6a21\u677f&#8221;\u53ef\u80fd\u88ab&#8221;\u91c7\u8d2d\u90e82023\u5e74\u603b\u7ed3&#8221;\u538b\u5728\u540e\u9762\u3002<\/p>\n<p>\u6211\u89c1\u8fc7\u6700\u79bb\u8c31\u7684case\u662f\u67d0\u5ba2\u6237\u7528\u8fd9\u5957\u65b9\u6848\uff0c50\u4e07\u6587\u4ef6\uff0c\u641c\u4e00\u4e2a\u5173\u952e\u8bcd\u89818\u79d2\u3002\u7528\u6237\u53cd\u9988\u8bf4&#8221;\u6839\u672c\u6ca1\u6cd5\u7528&#8221;\u3002<\/p>\n<p><h2><\/h2>\n<\/p>\n<p>MySQL\u5176\u5b9e\u6709\u5185\u7f6e\u7684\u5168\u6587\u7d22\u5f15\u80fd\u529b\uff0c\u53ea\u662f\u77e5\u9053\u7684\u4eba\u4e0d\u591a\u3002<\/p>\n<p>&#8220;`sql<br \/>\nALTER TABLE files ADD FULLTEXT INDEX ft_file_name (file_name, file_path);<\/p>\n<p>&#8212; \u641c\u7d22<br \/>\nSELECT *, MATCH(file_name, file_path) AGAINST(&#8216;\u5173\u952e\u8bcd&#8217;) AS relevance<br \/>\nFROM files<br \/>\nWHERE MATCH(file_name, file_path) AGAINST(&#8216;\u5173\u952e\u8bcd&#8217; IN NATURAL LANGUAGE MODE)<br \/>\nORDER BY relevance DESC<br \/>\nLIMIT 100;<br \/>\n&#8220;`<\/p>\n<p>\u8fd9\u6bd4LIKE\u5f3a\u5728\u54ea\uff1f<\/p>\n<p>&#8211; \u652f\u6301<strong><\/strong>\uff0c\u4f1a\u81ea\u52a8\u5904\u7406\u5206\u8bcd<br \/>\n&#8211; \u53ef\u4ee5\u6309<strong><\/strong>\uff0c\u641c\u7d22\u7ed3\u679c\u8d28\u91cf\u9ad8\u5f88\u591a<br \/>\n&#8211; \u67e5\u8be2\u6027\u80fd\u6bd4LIKE\u597d\uff0c\u6709\u7d22\u5f15\u652f\u6491<\/p>\n<p>\u4f46\u95ee\u9898\u8fd8\u662f\u4e0d\u5c11\uff1a<\/p>\n<p><strong><\/strong><br \/>\nMySQL\u7684\u5168\u6587\u7d22\u5f15\u9ed8\u8ba4\u6309\u7a7a\u683c\u5206\u8bcd\uff0c\u53ea\u5bf9\u82f1\u6587\u6709\u6548\u3002\u4e2d\u6587\uff1f\u76f4\u63a5\u6b47\u83dc\u3002\u4f60\u5f97\u989d\u5916\u914d\u7f6e\u4e2d\u6587\u5206\u8bcd\u63d2\u4ef6\uff08ngram\uff09\uff0c\u800c\u4e14\u6548\u679c\u4e00\u822c\u3002<\/p>\n<p><strong><\/strong><br \/>\n\u82f1\u6587\u53ef\u4ee5\u7528\u540c\u4e49\u8bcd\u8bcd\u5178\uff0c\u4e2d\u6587\u6ca1\u6709\u6210\u719f\u65b9\u6848\u3002<\/p>\n<p><strong><\/strong><br \/>\n\u6587\u4ef6\u5143\u6570\u636e\u5206\u6563\u5728\u591a\u4e2a\u8868\uff08\u6587\u4ef6\u8868\u3001\u76ee\u5f55\u8868\u3001\u6807\u7b7e\u8868\u3001\u7528\u6237\u8868\uff09\uff0c\u8de8\u8868\u8054\u5408\u68c0\u7d22\u5f88\u9ebb\u70e6\u3002<\/p>\n<p>\u8fd9\u5957\u65b9\u6848\u6211\u4eec\u7528\u4e86\u4e00\u6bb5\u65f6\u95f4\uff0c\u540e\u6765\u63a5\u4e86\u4e00\u4e2a\u5ba2\u6237\uff0c\u5458\u5de5\u5168\u662f\u4e2d\u56fd\u4eba\uff0c\u6587\u4ef6\u540d\u5168\u662f\u4e2d\u6587\u3002\u6d4b\u8bd5\u7684\u65f6\u5019\u641c&#8221;\u5408\u540c&#8221;\uff0cMySQL\u8bf4\u6ca1\u7ed3\u679c\u3002\u6c14\u5f97\u6211\u5f53\u665a\u5c31\u51b3\u5b9a\u6362\u65b9\u6848\u3002<\/p>\n<p><h2><\/h2>\n<\/p>\n<p>Elasticsearch\u662f\u4e13\u95e8\u505a\u5168\u6587\u68c0\u7d22\u7684\u5f15\u64ce\uff0c\u5e95\u5c42\u662fLucene\uff0c\u7528\u5012\u6392\u7d22\u5f15\u505a\u68c0\u7d22\uff0c\u5929\u751f\u9002\u5408\u6d77\u91cf\u6587\u672c\u641c\u7d22\u573a\u666f\u3002<\/p>\n<p><h3><\/h3>\n<\/p>\n<p>&#8220;`<br \/>\n\u6587\u4ef6\u4e0a\u4f20 \u2192 \u6587\u4ef6\u670d\u52a1 \u2192 \u5199\u5165\u4e1a\u52a1\u6570\u636e\u5e93\uff08MySQL\uff09<br \/>\n                    \u2198 \u5199\u5165\u6d88\u606f\u961f\u5217 \u2192 \u7d22\u5f15\u670d\u52a1 \u2192 Elasticsearch\u96c6\u7fa4<br \/>\n&#8220;`<\/p>\n<p>\u6587\u4ef6\u5199\u5165\u65f6\uff0c\u5f02\u6b65\u53d1\u4e00\u6761\u6d88\u606f\u5230\u961f\u5217\uff0c\u7d22\u5f15\u670d\u52a1\u6d88\u8d39\u6d88\u606f\uff0c\u628a\u6587\u4ef6\u5143\u6570\u636e\uff08\u6587\u4ef6\u540d\u3001\u8def\u5f84\u3001\u6807\u7b7e\u3001\u6458\u8981\u7b49\uff09\u5199\u5165Elasticsearch\u3002<\/p>\n<p>&#8220;`javascript<br \/>\n\/\/ \u7d22\u5f15\u670d\u52a1\u6838\u5fc3\u4ee3\u7801\uff08Node.js + @elastic\/elasticsearch\uff09<\/p>\n<p>const { Client } = require(&#8216;@elastic\/elasticsearch&#8217;);<br \/>\nconst client = new Client({ node: &#8216;http:\/\/es-node-1:9200&#8217; });<\/p>\n<p>const INDEX_NAME = &#8216;enterprise_files&#8217;;<\/p>\n<p>\/\/ \u7d22\u5f15Mapping\u8bbe\u8ba1\uff08\u8e29\u5751\uff1a\u5b57\u6bb5\u7c7b\u578b\u9009\u9519\u4f1a\u5bfc\u81f4\u67e5\u8be2\u6027\u80fd\u66b4\u8dcc\uff09<br \/>\nasync function createIndex() {<br \/>\n    await client.indices.create({<br \/>\n        index: INDEX_NAME,<br \/>\n        body: {<br \/>\n            settings: {<br \/>\n                number_of_shards: 3,<br \/>\n                number_of_replicas: 1,<br \/>\n                \/\/ \u4e2d\u6587\u5206\u8bcd\u5668\u914d\u7f6e\uff08\u7528ik_max_word\uff0c\u7ec6\u7c92\u5ea6\u5206\u8bcd\uff09<br \/>\n                analysis: {<br \/>\n                    analyzer: {<br \/>\n                        ik_analyzer: {<br \/>\n                            type: &#8216;custom&#8217;,<br \/>\n                            tokenizer: &#8216;ik_max_word&#8217;,<br \/>\n                            filter: [&#8216;my_synonym_filter&#8217;, &#8216;asciifolding&#8217;]<br \/>\n                        }<br \/>\n                    },<br \/>\n                    filter: {<br \/>\n                        my_synonym_filter: {<br \/>\n                            type: &#8216;synonym&#8217;,<br \/>\n                            synonyms: [<br \/>\n                                \/\/ \u4f01\u4e1a\u4e91\u76d8\u5e38\u89c1\u540c\u4e49\u8bcd<br \/>\n                                &#8216;\u5408\u540c,\u534f\u8bae,contract&#8217;,<br \/>\n                                &#8216;\u91c7\u8d2d,\u8d2d\u4e70,\u8ba2\u8d2d&#8217;,<br \/>\n                                &#8216;\u65b9\u6848,\u8ba1\u5212,proposal&#8217;,<br \/>\n                                &#8216;\u62a5\u544a,\u62a5\u8868,\u603b\u7ed3&#8217;,<br \/>\n                                &#8216;\u56fe\u7eb8,\u8bbe\u8ba1\u56fe,dwg&#8217;,<br \/>\n                            ]<br \/>\n                        }<br \/>\n                    }<br \/>\n                }<br \/>\n            },<br \/>\n            mappings: {<br \/>\n                properties: {<br \/>\n                    file_id: { type: &#8216;keyword&#8217; },       \/\/ keyword\u4e0d\u5206\u8bcd\uff0c\u7cbe\u786e\u5339\u914d\u7528<br \/>\n                    file_name: {<br \/>\n                        type: &#8216;text&#8217;,<br \/>\n                        analyzer: &#8216;ik_analyzer&#8217;,<br \/>\n                        fields: {<br \/>\n                            raw: { type: &#8216;keyword&#8217; }    \/\/ \u540c\u65f6\u4fdd\u7559\u4e00\u4e2akeyword\u5b50\u5b57\u6bb5<br \/>\n                        }<br \/>\n                    },<br \/>\n                    file_path: { type: &#8216;text&#8217;, analyzer: &#8216;ik_analyzer&#8217; },<br \/>\n                    tags: { type: &#8216;keyword&#8217; },          \/\/ \u6807\u7b7e\u7cbe\u786e\u5339\u914d<br \/>\n                    content_text: { type: &#8216;text&#8217;, analyzer: &#8216;ik_analyzer&#8217; },  \/\/ \u6587\u4ef6\u5185\u5bb9\u63d0\u53d6\u6587\u672c<br \/>\n                    owner: { type: &#8216;keyword&#8217; },<br \/>\n                    department: { type: &#8216;keyword&#8217; },<br \/>\n                    created_at: { type: &#8216;date&#8217; },<br \/>\n                    updated_at: { type: &#8216;date&#8217; },<br \/>\n                    file_type: { type: &#8216;keyword&#8217; },<br \/>\n                    file_size: { type: &#8216;long&#8217; }<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    });<br \/>\n}<\/p>\n<p>\/\/ \u5199\u5165\u7d22\u5f15\uff08\u5f02\u6b65\uff0c\u4e0d\u80fd\u963b\u585e\u4e3b\u6d41\u7a0b\uff09<br \/>\nasync function indexFile(fileMeta) {<br \/>\n    try {<br \/>\n        await client.index({<br \/>\n            index: INDEX_NAME,<br \/>\n            id: fileMeta.file_id,<br \/>\n            document: {<br \/>\n                file_id: fileMeta.file_id,<br \/>\n                file_name: fileMeta.file_name,<br \/>\n                file_path: fileMeta.file_path,<br \/>\n                tags: fileMeta.tags || [],<br \/>\n                content_text: fileMeta.content_text || &#8221;,<br \/>\n                owner: fileMeta.owner,<br \/>\n                department: fileMeta.department,<br \/>\n                created_at: new Date(fileMeta.created_at).toISOString(),<br \/>\n                updated_at: new Date(fileMeta.updated_at).toISOString(),<br \/>\n                file_type: fileMeta.file_type,<br \/>\n                file_size: fileMeta.file_size<br \/>\n            }<br \/>\n        });<br \/>\n    } catch (err) {<br \/>\n        console.error(&#8216;\u7d22\u5f15\u5199\u5165\u5931\u8d25&#8217;, err);<br \/>\n        \/\/ \u8bb0\u5f55\u5931\u8d25\uff0c\u540e\u7eed\u91cd\u8bd5<br \/>\n        await recordIndexFailure(fileMeta.file_id, err);<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u641c\u7d22\u63a5\u53e3<br \/>\nasync function searchFiles(query, filters, pagination) {<br \/>\n    const { keyword, file_type, department, owner, date_range } = filters;<\/p>\n<p>    const must = [];<br \/>\n    const filter = [];<\/p>\n<p>    \/\/ \u5173\u952e\u8bcd\u641c\u7d22\uff08\u8de8\u591a\u4e2a\u5b57\u6bb5\uff09<br \/>\n    if (keyword) {<br \/>\n        must.push({<br \/>\n            multi_match: {<br \/>\n                query: keyword,<br \/>\n                fields: [&#8216;file_name^3&#8217;, &#8216;file_path^2&#8217;, &#8216;content_text&#8217;, &#8216;tags&#8217;],<br \/>\n                type: &#8216;best_fields&#8217;,<br \/>\n                fuzziness: &#8216;AUTO&#8217;  \/\/ \u6a21\u7cca\u5339\u914d\uff0c\u5bb9\u9519&#8221;\u7ec8\u7248&#8221;\u548c&#8221;\u7ec8\u677f&#8221;\u8f93\u9519\u7684\u60c5\u51b5<br \/>\n            }<br \/>\n        });<br \/>\n    }<\/p>\n<p>    \/\/ \u7cbe\u786e\u8fc7\u6ee4\u6761\u4ef6<br \/>\n    if (file_type) filter.push({ term: { file_type } });<br \/>\n    if (department) filter.push({ term: { department } });<br \/>\n    if (owner) filter.push({ term: { owner } });<\/p>\n<p>    \/\/ \u65e5\u671f\u8303\u56f4\u8fc7\u6ee4<br \/>\n    if (date_range) {<br \/>\n        filter.push({<br \/>\n            range: {<br \/>\n                updated_at: {<br \/>\n                    gte: date_range.start,<br \/>\n                    lte: date_range.end<br \/>\n                }<br \/>\n            }<br \/>\n        });<br \/>\n    }<\/p>\n<p>    const result = await client.search({<br \/>\n        index: INDEX_NAME,<br \/>\n        body: {<br \/>\n            from: (pagination.page &#8211; 1) * pagination.size,<br \/>\n            size: pagination.size,<br \/>\n            query: {<br \/>\n                bool: { must, filter }<br \/>\n            },<br \/>\n            sort: [<br \/>\n                { _score: &#8216;desc&#8217; },      \/\/ \u76f8\u5173\u5ea6\u4f18\u5148<br \/>\n                { updated_at: &#8216;desc&#8217; }   \/\/ \u518d\u6309\u66f4\u65b0\u65f6\u95f4<br \/>\n            ],<br \/>\n            highlight: {<br \/>\n                fields: {<br \/>\n                    file_name: {},<br \/>\n                    file_path: {},<br \/>\n                    content_text: { fragment_size: 150 }<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    });<\/p>\n<p>    return {<br \/>\n        total: result.hits.total.value,<br \/>\n        files: result.hits.hits.map(hit => ({<br \/>\n            file_id: hit._source.file_id,<br \/>\n            file_name: hit._source.file_name,<br \/>\n            file_path: hit._source.file_path,<br \/>\n            score: hit._score,<br \/>\n            highlights: hit.highlight<br \/>\n        })),<br \/>\n        took_ms: result.took<br \/>\n    };<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p><h3><\/h3>\n<\/p>\n<p><strong><\/strong><\/p>\n<p>\u4e00\u5f00\u59cb\u7528\u4e86Elasticsearch\u9ed8\u8ba4\u7684standard\u5206\u8bcd\u5668\uff0c\u7ed3\u679c\u641c&#8221;\u4f01\u4e1a\u4e91\u76d8&#8221;\uff0c\u53ea\u6309\u5b57\u7b26\u5207\u5206\uff0c&#8221;\u4f01\u4e1a&#8221;\u662f\u4e00\u4e2a\u8bcd\uff0c&#8221;\u4e91&#8221;\u662f\u4e00\u4e2a\u8bcd\uff0c&#8221;\u76d8&#8221;\u662f\u4e00\u4e2a\u8bcd\u3002\u641c&#8221;\u4e91\u76d8&#8221;\u80fd\u5339\u914d\uff0c\u4f46\u641c&#8221;\u4f01\u4e1a\u4e91&#8221;\u5c31\u5339\u914d\u4e0d\u5230\u4e86\u3002<\/p>\n<p>\u6362\u4e86ik_max_word\u5206\u8bcd\u5668\uff08\u7ec6\u7c92\u5ea6\uff09\uff0c&#8221;\u4f01\u4e1a\u4e91\u76d8&#8221;\u88ab\u5207\u6210&#8221;\u4f01\u4e1a&#8221;\u3001&#8221;\u4e91\u76d8&#8221;\u3001&#8221;\u4e91&#8221;\u3001&#8221;\u76d8&#8221;\u56db\u4e2a\u8bcd\uff0c\u518d\u641c\u7d22\u5c31\u80fd\u5339\u914d\u4e86\u3002<\/p>\n<p><strong><\/strong><\/p>\n<p>\u540c\u4e49\u8bcd\u8bcd\u5178\u5199\u8d77\u6765\u7b80\u5355\uff0c\u4f46\u7ef4\u62a4\u8d77\u6765\u9ebb\u70e6\u3002\u6211\u4e4b\u524d\u628a&#8221;\u5408\u540c,\u534f\u8bae&#8221;\u5199\u8fdb\u53bb\uff0c\u7ed3\u679c\u641c&#8221;\u5408\u540c&#8221;\u80fd\u627e\u5230&#8221;\u534f\u8bae&#8221;\uff0c\u641c&#8221;\u534f\u8bae&#8221;\u4e5f\u80fd\u627e\u5230&#8221;\u5408\u540c&#8221;\u3002\u4f46\u95ee\u9898\u662f\u4e1a\u52a1\u4e0a&#8221;\u5408\u540c&#8221;\u548c&#8221;\u534f\u8bae&#8221;\u6709\u65f6\u5019\u4e0d\u5b8c\u5168\u7b49\u4ef7\u2014\u2014\u5408\u540c\u901a\u5e38\u6307\u6b63\u5f0f\u7b7e\u7f72\u7684\u6cd5\u5f8b\u6587\u4ef6\uff0c\u534f\u8bae\u53ef\u80fd\u662f\u610f\u5411\u4e66\u6216\u8005\u8865\u5145\u6761\u6b3e\u3002<\/p>\n<p>\u540e\u6765\u6539\u6210\u4e1a\u52a1\u76f8\u5173\u8bcd\u624d\u52a0\u540c\u4e49\u8bcd\uff0c\u548c\u4e1a\u52a1\u65e0\u5173\u7684\u8bcd\u4e0d\u52a0\u3002<\/p>\n<p><strong><\/strong><\/p>\n<p>\u8fd9\u662f\u6700\u5927\u7684\u5751\u3002\u6587\u4ef6\u5728MySQL\u91cc\u66f4\u65b0\u4e86\uff0c\u4f46ES\u7d22\u5f15\u662f\u5f02\u6b65\u5199\u5165\u7684\uff0c\u6709\u51e0\u79d2\u5ef6\u8fdf\u3002\u7528\u6237\u521a\u4e0a\u4f20\u6587\u4ef6\uff0c\u7acb\u523b\u641c\u7d22\uff0c\u641c\u4e0d\u5230\u3002\u7528\u6237\u9a82&#8221;\u641c\u7d22\u662f\u5047\u7684&#8221;\u3002<\/p>\n<p>\u540e\u6765\u52a0\u4e86\u5f3a\u5236\u5237\u65b0\u673a\u5236\uff1a\u91cd\u8981\u64cd\u4f5c\uff08\u5982\u6587\u4ef6\u91cd\u547d\u540d\u3001\u79fb\u52a8\uff09\u5b8c\u6210\u540e\uff0c\u7acb\u5373\u89e6\u53d1ES\u7d22\u5f15\u5237\u65b0\uff0c\u4e0d\u7b49\u5f02\u6b65\u961f\u5217\u3002<\/p>\n<p>&#8220;`javascript<br \/>\n\/\/ \u5f3a\u5236\u5237\u65b0\u7d22\u5f15\uff08\u4e0d\u63a8\u8350\u9891\u7e41\u4f7f\u7528\uff0c\u5f71\u54cd\u6027\u80fd\uff09<br \/>\nawait client.indices.refresh({ index: INDEX_NAME });<br \/>\n&#8220;`<\/p>\n<p>\u66f4\u597d\u7684\u65b9\u6848\u662f\uff1a\u628a&#8221;\u7acb\u5373\u9700\u8981\u641c\u7d22\u5230&#8221;\u548c&#8221;\u53ef\u4ee5\u7b49\u51e0\u79d2\u518d\u641c\u5230&#8221;\u5206\u5f00\u5904\u7406\u3002\u524d\u8005\u7528MySQL\u7684\u5168\u6587\u7d22\u5f15\u505a\u515c\u5e95\uff0c\u540e\u8005\u7528ES\u3002<\/p>\n<p><strong><\/strong><\/p>\n<p>ES\u7d22\u5f15\u548cMySQL\u6570\u636e\u4e0d\u540c\u6b65\uff0cMySQL\u91cc\u6587\u4ef6\u5220\u4e86\uff0cES\u91cc\u8fd8\u6709\u3002\u641c\u51fa\u6765\u7684\u7ed3\u679c\u70b9\u8fdb\u53bb\u662f404\u3002<\/p>\n<p>\u89e3\u6cd5\uff1a\u5b9a\u65f6\u505a\u5168\u91cf\u6821\u9a8c\uff0cES\u91cc\u7684\u6bcf\u4e2afile_id\u90fd\u53bbMySQL\u67e5\u4e00\u4e0b\uff0c\u4e0d\u5b58\u5728\u7684\u5c31\u5220\u6389\u3002\u6216\u8005\u5728\u67e5\u8be2\u7ed3\u679c\u91cc\u52a0\u4e00\u5c42\u6821\u9a8c\uff0c\u5c55\u793a\u524d\u5148\u786e\u8ba4\u6587\u4ef6\u8fd8\u5b58\u5728\u3002<\/p>\n<p><h2><\/h2>\n<\/p>\n<p>\u5173\u952e\u8bcd\u641c\u7d22\u7684\u74f6\u9888\u662f<strong><\/strong>\u3002\u7528\u6237\u641c&#8221;\u5f20\u603b\u7684\u9879\u76ee\u5408\u540c&#8221;\uff0c\u5173\u952e\u8bcd\u641c\u7d22\u53ea\u80fd\u5339\u914d\u5305\u542b\u8fd9\u56db\u4e2a\u8bcd\u7684\u6587\u4ef6\u3002\u4f46\u7528\u6237\u771f\u6b63\u60f3\u627e\u7684\u53ef\u80fd\u662f&#8221;\u5f20\u603b\u8d1f\u8d23\u7684XX\u9879\u76ee\u91c7\u8d2d\u5408\u540c_v3_v4_final_signed.pdf&#8221;\u2014\u2014\u6587\u4ef6\u540d\u91cc\u6839\u672c\u6ca1\u6709&#8221;\u9879\u76ee&#8221;\u8fd9\u4e2a\u8bcd\u3002<\/p>\n<p>\u8bed\u4e49\u641c\u7d22\u80fd\u7406\u89e3&#8221;\u5f20\u603b\u7684\u9879\u76ee\u5408\u540c&#8221;\u8868\u8fbe\u7684\u610f\u601d\uff0c\u800c\u4e0d\u662f\u5b57\u9762\u4e0a\u7684\u8bcd\u5339\u914d\u3002<\/p>\n<p><h3><\/h3>\n<\/p>\n<p>\u8bed\u4e49\u641c\u7d22\u6709\u4e24\u79cd\u5b9e\u73b0\u8def\u5f84\uff1a<\/p>\n<p><strong><\/strong><\/p>\n<p>\u628a\u6587\u4ef6\u5143\u6570\u636e\u548c\u7528\u6237\u67e5\u8be2\u90fd\u8f6c\u6210\u5411\u91cf\uff0c\u5728\u5411\u91cf\u7a7a\u95f4\u91cc\u505a\u76f8\u4f3c\u5ea6\u641c\u7d22\u3002\u8bed\u4e49\u76f8\u8fd1\u7684\u5185\u5bb9\uff0c\u5411\u91cf\u8ddd\u79bb\u8fd1\u3002<\/p>\n<p>&#8220;`python<\/p>\n<h1><\/h1>\n<\/p>\n<p>from sentence_transformers import SentenceTransformer<br \/>\nimport chromadb<\/p>\n<p><h1><\/h1>\n<p>model = SentenceTransformer(&#8216;moka-ai\/m3e-base&#8217;)<\/p>\n<p><h1><\/h1>\n<p>client = chromadb.Client()<br \/>\ncollection = client.create_collection(&#8220;file_embeddings&#8221;)<\/p>\n<p>def embed_file(file_meta):<br \/>\n    &#8220;&#8221;&#8221;\u5c06\u6587\u4ef6\u5143\u6570\u636e\u8f6c\u6362\u4e3a\u5411\u91cf&#8221;&#8221;&#8221;<br \/>\n    text = f&#8221;{file_meta[&#8216;file_name&#8217;]} {file_meta[&#8216;file_path&#8217;]} {&#8216; &#8216;.join(file_meta.get(&#8216;tags&#8217;, []))}&#8221;<br \/>\n    embedding = model.encode(text).tolist()<\/p>\n<p>    collection.add(<br \/>\n        ids=[file_meta[&#8216;file_id&#8217;]],<br \/>\n        embeddings=[embedding],<br \/>\n        metadatas=[{<br \/>\n            &#8216;file_name&#8217;: file_meta[&#8216;file_name&#8217;],<br \/>\n            &#8216;file_path&#8217;: file_meta[&#8216;file_path&#8217;],<br \/>\n            &#8216;owner&#8217;: file_meta[&#8216;owner&#8217;]<br \/>\n        }]<br \/>\n    )<\/p>\n<p>def semantic_search(query, top_k=10):<br \/>\n    &#8220;&#8221;&#8221;\u8bed\u4e49\u641c\u7d22&#8221;&#8221;&#8221;<br \/>\n    query_embedding = model.encode(query).tolist()<\/p>\n<p>    results = collection.query(<br \/>\n        query_embeddings=[query_embedding],<br \/>\n        n_results=top_k<br \/>\n    )<\/p>\n<p>    return results<\/p>\n<p><h1><\/h1>\n<h1><\/h1>\n<h1><\/h1>\n<h1><\/h1>\n<p>&#8220;`<\/p>\n<p><strong><\/strong><\/p>\n<p>\u8ba9\u5927\u6a21\u578b\u7406\u89e3\u7528\u6237\u67e5\u8be2\u7684\u610f\u56fe\uff0c\u7136\u540e\u7528\u610f\u56fe\u53bb\u68c0\u7d22\u3002<\/p>\n<p>&#8220;`javascript<br \/>\n\/\/ RAG\u65b9\u6848\uff08\u7b80\u5316\u7248\uff09<\/p>\n<p>async function intelligentSearch(userQuery) {<br \/>\n    \/\/ Step 1: \u7406\u89e3\u7528\u6237\u610f\u56fe\uff08\u7528LLM\u63d0\u53d6\u641c\u7d22\u6761\u4ef6\uff09<br \/>\n    const intent = await llm.analyze(`<br \/>\n\u7528\u6237\u67e5\u8be2\uff1a&#8221;${userQuery}&#8221;<br \/>\n\u8bf7\u63d0\u53d6\u4ee5\u4e0b\u4fe1\u606f\uff08JSON\u683c\u5f0f\uff09\uff1a<br \/>\n{<br \/>\n    &#8220;keywords&#8221;: [&#8220;\u5173\u952e\u8bcd\u5217\u8868&#8221;],<br \/>\n    &#8220;person&#8221;: &#8220;\u6d89\u53ca\u7684\u4eba\u540d&#8221;,<br \/>\n    &#8220;intent&#8221;: &#8220;\u641c\u7d22\u610f\u56fe\uff1a\u627e\u6587\u4ef6\/\u627e\u4eba\/\u627e\u7248\u672c\/\u5176\u4ed6&#8221;,<br \/>\n    &#8220;time_range&#8221;: &#8220;\u65f6\u95f4\u8303\u56f4\uff08\u5982\u679c\u6709\uff09&#8221;<br \/>\n}<br \/>\n    `);<\/p>\n<p>    \/\/ Step 2: \u57fa\u4e8e\u610f\u56fe\u6784\u5efa\u641c\u7d22query<br \/>\n    let esQuery = {<br \/>\n        bool: {<br \/>\n            must: [],<br \/>\n            filter: []<br \/>\n        }<br \/>\n    };<\/p>\n<p>    if (intent.keywords?.length) {<br \/>\n        esQuery.bool.must.push({<br \/>\n            multi_match: {<br \/>\n                query: intent.keywords.join(&#8216; &#8216;),<br \/>\n                fields: [&#8216;file_name^3&#8217;, &#8216;file_path^2&#8217;, &#8216;content_text&#8217;]<br \/>\n            }<br \/>\n        });<br \/>\n    }<\/p>\n<p>    if (intent.person) {<br \/>\n        \/\/ \u4eba\u540d \u2192 \u90e8\u95e8\/\u8d1f\u8d23\u4eba\u6620\u5c04 \u2192 \u7cbe\u786e\u8fc7\u6ee4<br \/>\n        const dept = await getDepartmentByPerson(intent.person);<br \/>\n        if (dept) {<br \/>\n            esQuery.bool.filter.push({ term: { department: dept } });<br \/>\n        }<br \/>\n    }<\/p>\n<p>    \/\/ Step 3: \u6267\u884c\u641c\u7d22<br \/>\n    const results = await elasticsearch.search(esQuery);<\/p>\n<p>    \/\/ Step 4: \u751f\u6210\u56de\u7b54\uff08\u53ef\u9009\uff0c\u8ba9AI\u603b\u7ed3\u641c\u7d22\u7ed3\u679c\uff09<br \/>\n    const summary = await llm.summarize(`<br \/>\n\u641c\u7d22\u610f\u56fe\uff1a${intent.intent}<br \/>\n\u641c\u7d22\u7ed3\u679c\uff1a${JSON.stringify(results.files)}<br \/>\n\u7528\u6237\u95ee\u9898\uff1a${userQuery}<br \/>\n\u8bf7\u7528\u81ea\u7136\u8bed\u8a00\u603b\u7ed3\u641c\u7d22\u7ed3\u679c\uff0c\u6307\u51fa\u6700\u76f8\u5173\u7684\u51e0\u4e2a\u6587\u4ef6\u3002<br \/>\n    `);<\/p>\n<p>    return { results, summary };<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p><h3><\/h3>\n<\/p>\n<p><strong><\/strong><\/p>\n<p>\u901a\u7528\u4e2d\u6587Embedding\u6a21\u578b\uff08\u5982text2vec-base\uff09\u5728\u901a\u7528\u573a\u666f\u4e0b\u6548\u679c\u4e00\u822c\uff0c\u4f46\u5728\u4f01\u4e1a\u4e91\u76d8\u8fd9\u79cd\u5782\u76f4\u9886\u57df\u6548\u679c\u4e0d\u597d\u3002\u4f01\u4e1a\u6587\u4ef6\u91cc\u6709\u5927\u91cf\u4e13\u4e1a\u672f\u8bed\uff1a&#8221;\u7b49\u4fdd&#8221;\u3001&#8221;\u4e09\u7ea7\u7b49\u4fdd&#8221;\u3001&#8221;\u5dee\u5f02\u5907\u4efd&#8221;\u3001&#8221;\u589e\u91cf\u540c\u6b65&#8221;\u2014\u2014\u901a\u7528\u6a21\u578b\u6839\u672c\u4e0d\u8ba4\u8bc6\u8fd9\u4e9b\u8bcd\u3002<\/p>\n<p>\u6211\u4eec\u540e\u6765\u7528\u4e86M3E\u6a21\u578b\uff08moka-ai\/m3e-base\uff09\uff0c\u5728\u4e2d\u6587\u8bed\u4e49\u4efb\u52a1\u4e0a\u6548\u679c\u660e\u663e\u597d\u5f88\u591a\u3002\u5982\u679c\u9884\u7b97\u5145\u8db3\uff0c\u5efa\u8bae\u7528RLHF\u5fae\u8c03\u8fc7\u7684\u9886\u57df\u6a21\u578b\u3002<\/p>\n<p><strong><\/strong><\/p>\n<p>\u7eaf\u5411\u91cf\u641c\u7d22\u6709\u4e2a\u95ee\u9898\uff1a\u7cbe\u786e\u5339\u914d\uff08\u5982\u641c\u6587\u4ef6\u7f16\u53f7&#8221;CONTRACT-2024-001&#8243;\uff09\u53ef\u80fd\u88ab\u8bed\u4e49\u76f8\u8fd1\u4f46\u5b57\u9762\u4e0d\u5339\u914d\u7684\u7ed3\u679c\u6df9\u6ca1\u3002<\/p>\n<p>\u6b63\u786e\u505a\u6cd5\u662f<strong><\/strong>\uff1a\u5411\u91cf\u641c\u7d22\u548c\u5173\u952e\u8bcd\u641c\u7d22\u5404\u8dd1\u4e00\u904d\uff0c\u7528RRF\uff08Reciprocal Rank Fusion\uff09\u878d\u5408\u7ed3\u679c\u3002<\/p>\n<p>&#8220;`javascript<br \/>\n\/\/ \u6df7\u5408\u68c0\u7d22\u5b9e\u73b0<\/p>\n<p>async function hybridSearch(query, top_k=20) {<br \/>\n    \/\/ \u5e76\u884c\u8dd1\u4e24\u4e2a\u641c\u7d22<br \/>\n    const [keywordResults, vectorResults] = await Promise.all([<br \/>\n        keywordSearch(query, top_k),    \/\/ Elasticsearch BM25<br \/>\n        vectorSearch(query, top_k)       \/\/ \u5411\u91cf\u76f8\u4f3c\u5ea6<br \/>\n    ]);<\/p>\n<p>    \/\/ RRF\u878d\u5408\uff08Reciprocal Rank Fusion\uff09<br \/>\n    const k = 60;  \/\/ \u878d\u5408\u53c2\u6570\uff0c\u8d8a\u5927\u8d8a\u503e\u5411\u4e8e\u5747\u5300\u6df7\u5408<br \/>\n    const fusedScores = new Map();<\/p>\n<p>    keywordResults.forEach((r, idx) => {<br \/>\n        fusedScores.set(r.file_id, (fusedScores.get(r.file_id) || 0) + 1 \/ (k + idx + 1));<br \/>\n    });<\/p>\n<p>    vectorResults.forEach((r, idx) => {<br \/>\n        fusedScores.set(r.file_id, (fusedScores.get(r.file_id) || 0) + 1 \/ (k + idx + 1));<br \/>\n    });<\/p>\n<p>    \/\/ \u6309\u878d\u5408\u5206\u6570\u6392\u5e8f<br \/>\n    const fused = Array.from(fusedScores.entries())<br \/>\n        .sort((a, b) => b[1] &#8211; a[1])<br \/>\n        .slice(0, top_k);<\/p>\n<p>    return fused;<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p><strong><\/strong><\/p>\n<p>\u5411\u91cf\u6570\u636e\u5e93\u5b58\u7684\u662f\u6d6e\u70b9\u6570\u6570\u7ec4\uff0c\u5b58\u50a8\u7a7a\u95f4\u6bd4\u4f20\u7edf\u6570\u636e\u5e93\u5927\u5f97\u591a\u3002100\u4e07\u4e2a\u6587\u4ef6\uff0c\u6bcf\u4e2a\u6587\u4ef6128\u7ef4float32\u5411\u91cf\uff0c\u5360\u7528\u7a7a\u95f4\u7ea6500MB\u3002200\u7ef4\u5c31\u7ffb\u500d\u52301GB\uff0c512\u7ef4\u5c31\u662f2.5GB\u3002<\/p>\n<p>\u67e5\u8be2\u6027\u80fd\u4e5f\u8ddf\u5411\u91cf\u7ef4\u5ea6\u6709\u5173\u3002\u7ef4\u5ea6\u8d8a\u9ad8\uff0c\u7cbe\u786e\u641c\u7d22\u7684\u8ba1\u7b97\u91cf\u8d8a\u5927\u3002\u7528HNSW\uff08\u5206\u5c42\u53ef\u5bfc\u822a\u5c0f\u4e16\u754c\u56fe\uff09\u505a\u8fd1\u4f3c\u6700\u8fd1\u90bb\u641c\u7d22\uff08ANN\uff09\uff0c\u53ef\u4ee5\u5728\u7cbe\u5ea6\u635f\u5931\u53ef\u63a5\u53d7\u7684\u60c5\u51b5\u4e0b\u5927\u5e45\u63d0\u5347\u67e5\u8be2\u901f\u5ea6\u3002<\/p>\n<p><h2><\/h2>\n<\/p>\n<p>\u7ed9\u4e00\u5bb6\u5ba2\u6237\u4e0a\u4e86\u8bed\u4e49\u641c\u7d22\u540e\uff0c\u4ed6\u4eec\u53cd\u9988\u7684\u6570\u636e\uff1a<\/p>\n<p>| \u6307\u6807 | \u6539\u9020\u524d\uff08ES\u5173\u952e\u8bcd\uff09 | \u6539\u9020\u540e\uff08\u6df7\u5408\u641c\u7d22\uff09 |<br \/>\n|&#8212;&#8212;|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-|<br \/>\n| \u5e73\u5747\u641c\u7d22\u5ef6\u8fdf | 320ms | 580ms |<br \/>\n| \u7528\u6237\u6ee1\u610f\u5ea6\uff08\u597d\u8bc4\u7387\uff09 | 62% | 89% |<br \/>\n| \u641c\u4e0d\u5230&#8221;\u76f8\u5173\u6587\u4ef6&#8221;\u6295\u8bc9 | \u6bcf\u670840+\u6b21 | \u6bcf\u67085\u6b21\u4ee5\u4e0b |<br \/>\n| \u4eba\u540d\/\u9879\u76ee\u540d\u641c\u7d22\u6210\u529f\u7387 | 35% | 82% |<\/p>\n<p>\u6210\u672c\u65b9\u9762\uff1aES\u96c6\u7fa4\u6708\u8d39\u7528\u7ea62000\u5143\uff082\u53f04\u68388G\u673a\u5668\uff09\uff0c\u8bed\u4e49\u641c\u7d22\u989d\u5916\u589e\u52a0\u7ea61500\u5143\uff08\u5411\u91cf\u6570\u636e\u5e93+\u6a21\u578b\u63a8\u7406\uff09\u3002<\/p>\n<p><h2><\/h2>\n<\/p>\n<p><strong><\/strong><\/p>\n<p>\u8fd9\u662f\u57fa\u7840\uff0c\u8bed\u4e49\u641c\u7d22\u662f\u5efa\u7acb\u5728\u7d22\u5f15\u4f53\u7cfb\u4e4b\u4e0a\u7684\u3002\u5148\u628a\u57fa\u7840\u8bbe\u65bd\u642d\u597d\uff0c\u518d\u53e0\u52a0AI\u80fd\u529b\u3002<\/p>\n<p><strong><\/strong><\/p>\n<p>\u540c\u4e49\u8bcd\u8bcd\u5178\u662f\u6700\u5feb\u51fa\u6548\u679c\u7684\u4f18\u5316\u3002&#8221;\u5408\u540c&#8221;=&#8221;\u534f\u8bae&#8221;\u3001&#8221;\u91c7\u8d2d&#8221;=&#8221;\u8d2d\u4e70&#8221;\uff0c\u52a0\u51e0\u6761\u540c\u4e49\u8bcd\u89c4\u5219\uff0c\u7528\u6237\u641c&#8221;\u534f\u8bae&#8221;\u5c31\u80fd\u627e\u5230&#8221;\u5408\u540c&#8221;\u4e86\u3002<\/p>\n<p>\u7ea0\u9519\u4e5f\u5f88\u91cd\u8981\u3002\u5168\u89d2\/\u534a\u89d2\u8f6c\u6362\u3001\u62fc\u5199\u7ea0\u9519\u3001\u7b80\u7e41\u4f53\u8f6c\u6362\uff0c\u8fd9\u4e9b\u5c0f\u529f\u80fd\u5bf9\u4f53\u9a8c\u5f71\u54cd\u5f88\u5927\u3002<\/p>\n<p><strong><\/strong><\/p>\n<p>\u8bed\u4e49\u641c\u7d22\u6210\u672c\u9ad8\u3001\u590d\u6742\u5ea6\u9ad8\uff0c\u5efa\u8bae\u5728\u5173\u952e\u8bcd\u641c\u7d22\u5df2\u7ecf\u6ee1\u8db380%\u9700\u6c42\u4e4b\u540e\uff0c\u4f5c\u4e3a\u589e\u503c\u80fd\u529b\u53e0\u52a0\u3002<\/p>\n<p><strong><\/strong><\/p>\n<p>\u641c\u7d22\u4f53\u9a8c\u662f\u6301\u7eed\u4f18\u5316\u51fa\u6765\u7684\u3002\u5b9a\u671f\u770b\u7528\u6237\u7684&#8221;\u65e0\u7ed3\u679c\u641c\u7d22\u8bcd&#8221;\uff0c\u5206\u6790\u4e3a\u4ec0\u4e48\u641c\u4e0d\u5230\uff0c\u662f\u8bcd\u5e93\u91cc\u7f3a\u8bcd\u8fd8\u662f\u540c\u4e49\u8bcd\u914d\u7f6e\u4e0d\u5bf9\uff0c\u6301\u7eed\u8fed\u4ee3\u3002<\/p>\n<p>&#8212;<\/p>\n<p><h2><\/h2>\n<\/p>\n<p>\u4f01\u4e1a\u4e91\u76d8\u641c\u7d22\u7684\u6f14\u8fdb\u8def\u5f84\uff1a<\/p>\n<p>1. <strong><\/strong>\uff1a\u80fd\u641c\uff0c\u4f46\u4f53\u9a8c\u5dee\uff0c\u9002\u5408\u6587\u4ef6\u6570\u91cf<10\u4e07\u7684\u573a\u666f\n2. <strong><\/strong>\uff1a\u652f\u6301\u5206\u8bcd\u548c\u76f8\u5173\u6027\u6392\u5e8f\uff0c\u4e2d\u6587\u9700\u8981ngram\u63d2\u4ef6\uff0c\u9002\u5408\u6587\u4ef6\u6570\u91cf<50\u4e07\n3. <strong><\/strong>\uff1a\u4e13\u4e1a\u5168\u6587\u68c0\u7d22\uff0c\u652f\u6301\u4e2d\u6587\u5206\u8bcd\u3001\u540c\u4e49\u8bcd\u3001\u76f8\u5173\u6027\u6392\u5e8f\uff0c\u9002\u5408\u6587\u4ef6\u6570\u91cf>50\u4e07<br \/>\n4. <strong><\/strong>\uff1a\u7406\u89e3\u8bed\u4e49\uff0c\u652f\u6301\u610f\u56fe\u641c\u7d22\uff0c\u9002\u5408\u9700\u8981&#8221;\u627e\u76f8\u5173\u6587\u4ef6&#8221;\u7684\u573a\u666f<\/p>\n<p>\u4e0d\u662f\u6bcf\u4e2a\u4e91\u76d8\u90fd\u9700\u8981\u4e0a\u8bed\u4e49\u641c\u7d22\u3002\u5148\u7528Elasticsearch\u628a\u57fa\u7840\u6253\u597d\uff0c\u8bc4\u4f30\u7528\u6237\u5b9e\u9645\u9700\u6c42\u540e\u518d\u51b3\u5b9a\u662f\u5426\u5f15\u5165AI\u80fd\u529b\u3002\u8fc7\u5ea6\u8bbe\u8ba1\u662f\u6d6a\u8d39\uff0c\u591f\u7528\u5c31\u597d\u3002<\/p>\n<p>&#8212;<\/p>\n<p><strong><\/strong>\uff1aElasticsearch \/ MeiliSearch \/ \u5411\u91cf\u6570\u636e\u5e93 \/ \u4e2d\u6587\u5206\u8bcd \/ \u8bed\u4e49\u641c\u7d22<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212; platform: wp article_i&#8230; <a class=\"read-more\" href=\"https:\/\/www.babel.cc\/blog\/?p=6850\">[Continue Reading]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6850","post","type-post","status-publish","format-standard","hentry","category-1","no-post-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6850"}],"version-history":[{"count":1,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6850\/revisions"}],"predecessor-version":[{"id":6851,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6850\/revisions\/6851"}],"wp:attachment":[{"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.babel.cc\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}