{"id":19,"date":"2024-05-28T19:50:25","date_gmt":"2024-05-28T11:50:25","guid":{"rendered":"http:\/\/www.yixi.ltd\/?p=19"},"modified":"2024-05-28T19:50:25","modified_gmt":"2024-05-28T11:50:25","slug":"sphinx","status":"publish","type":"post","link":"https:\/\/www.bengbu.host\/?p=19","title":{"rendered":"sphinx"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u4f7f\u7528\u573a\u666f \u5728MYSQL\u4e2d\u5f53\u5bf9\u4e00\u4e2a\u6587\u672c\u7c7b\u578b\u7684\u5b57\u6bb5\u8fdb\u884cLIKE \u5e76\u4ee5%\u5f00\u5934\u7684\u67e5\u8be2\u65f6\uff0c\u4f1a\u8fdb\u884c\u5168\u8868\u626b\u63cf\u3002 \u6bd4\u5982 \u6211\u4eec\u5546\u54c1\u4e2d\u6709\u5546\u54c1500\u4e07\u4ef6\u3002\u5982\u679c\u6211\u4eec\u8981\u641c\u7d22\u5546\u54c1\u540d\u79f0\u4e2d\u5e26\u7ea2\u8272\u7684\uff0c\u5982\u679c\u4e0d\u4e14SPHINX\u80af\u5b9a\u662f\u8fd9\u6837\u5199\uff1a \u539f\u56e0\u4e00\u3001\u5168\u8868\u626b\u63cf\u6162\uff1a SELECT * FROM php34_goods WHERE goods_name LIKE \u2018%\u7ea2\u8272%\u2019; \u8fd9\u6761SQL\u4f1a\u8fdb\u884c\u5168\u8868\u626b\u63cf\uff0c\u6240\u4ee5\u6027\u80fd\u975e\u5e38\u6162\uff0c\u67e5\u8be2\u901f\u5ea6\u975e\u5e38\u6162\u3002 \u539f\u56e0\u4e8c\u3001MYSQL\u6ca1\u6709\u4e2d\u6587\u5206\u8bcd\uff0c\u800c\u4e00\u822c\u5bf9\u77ed\u8bed\u641c\u7d22\u65f6\u5fc5\u987b\u5206\u8bcd\u624d\u80fd\u641c\u7d22<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sphinx\u5c31\u53ef\u4ee5\u89e3\u51b3\u4ee5\u4e0a\u4e24\u4e2a\u95ee\u9898\uff1a \u603b\u7ed3\uff1a\u5f53\u4e00\u4e2a\u529f\u80fd\u9700\u8981\u5bf9\u8868\u4e2dtext,varchar\u7b49\u6587\u672c\u7c7b\u578b\u7684\u5b57\u6bb5\u8fdb\u884cLIKE \u67e5\u8be2\u65f6\uff0c\u5982\uff08\u6839\u636e\u6b4c\u8bcd\u641c\u7d22\u6b4c\u66f2\u8fd9\u4e2a\u529f\u80fd\uff09MYSQL\u662f\u5168\u8868\u626b\u63cf\u975e\u5e38\u6162\uff0c\u9700\u8981\u4f7f\u7528SPHINX\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SPHINX\u4f18\u5316\uff1a1.\u89e3\u51b3\u6027\u80fd\u95ee\u9898 2.\u89e3\u51b3\u4e2d\u6587\u5206\u8bcd\u7684\u95ee\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sphinx\u6709\u4e24\u79cd\u4f7f\u7528\u65b9\u5f0f\uff1a \u7528\u6cd5\u4e00\u539f\u59cb\u7528\u6cd5\uff1aSPHINX\u548cmysql\u662f\u4e24\u4e2a\u72ec\u7acb\u7684\u670d\u52a1\u5668 \u6d41\u7a0b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>PHP\u8981\u5148\u628a\u8981\u641c\u7d22\u7684\u77ed\u8bed\u53d1\u7ed9SPHINX\u670d\u52a1\u5668\uff0cSPHINX\u8fd4\u56de\u7684\u662f\u8bb0\u5f55\u7684ID<\/li>\n\n\n\n<li>PHP \u518d\u4f7f\u7528sphinx\u8fd4\u56de\u7684ID\u67e5\u8be2\u6570\u636e\u5e93 \u7528\u6cd5\u4e00\u3001\uff1ashpinxse:\u628aSPHINX\u96c6\u6210\u5230MYSQL\u91cc\u53bb\uff08\u6ca1\u6709\u5355\u72ec\u7684shpinx\u670d\u52a1\u5668\uff09 PHP\u53ea\u9700\u8981\u5199\u4e00\u4e2aSQL\u8bed\u53e5\u5373\u53ef\uff0c\u4e0d\u7528\u5f88\u7ba1SPHINX\uff0cMYSQL\u4f1a\u81ea\u5df1\u8fde\u63a5\u67e5\u8be2sphinx\u3002\u5982\u679c\u8981\u4f7f\u7528\u8fd9\u79cd \u9700\u8981\u5728LINUX\u4e0b\u91cd\u65b0\u7f16\u8bd1MYSQL\uff0c\u628aSPHINX\u5f53\u6210\u63d2\u4ef6\u7f16\u8bd1\u5230MYSQL\u4e2d\u53bb\u3002<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b9e\u9645\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5148\u4e0b\u8f7dsphinx\u7684\u5305\uff0c\u6211\u4eec\u4e0b\u8f7d\u7684\u662fcoreseek\u3002 corecoek\u4e2d\u4e00\u4e2a\u52a0\u4e86\u4e2d\u6587\u529f\u80fd\u7684sphinx\u3002<\/li>\n\n\n\n<li>\u4e0b\u8f7d\u5305\u4e4b\u540e\u51e0\u4e2a\u91cd\u8981\u6587\u4ef6\u8bf4\u660e\uff1a etc\/csft_mysql.conf \u914d\u7f6e\u6587\u4ef6 bin\/indexer.exe \u521b\u5efa\u5168\u6587\u7d22\u5f15 bin\/searchd.exe \u542f\u52a8\u670d\u52a1\u5668\uff0c\u9700\u521b\u5efa\u7d22\u5f15 api\/sphinx.php php \u64cd\u4f5c\u7c7b<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b9e\u9645\u5e94\u7528\uff1a\u5148\u590d\u5236MYSQL\u7684\u914d\u7f6e\u6587\u4ef6\u6a21\u677f\u5230\u6839\u76ee\u5f55\u4e0b\u5e76\u6539\u540d\u4e3asphinx.conf \u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u597d\u4e4b\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u6587\u4ef6\u751f\u6210\u7d22\u5f15\u4e86\uff1a \u5b89\u88c5sphinx\u670d\u52a1\u5668 \u6253\u5f00\u670d\u52a1\u7a97\u53e3\u542f\u7528sphinx:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5199PHP\u4ee3\u7801\u64cd\u4f5cSPHINX A. \u5148\u590d\u5236coreseek\u5305\u4e2d\u7684sphinxapi.php\u6587\u4ef6\u5230\u9879\u76ee\u4e2d\uff1a<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528\u573a\u666f \u5728MYSQL\u4e2d\u5f53\u5bf9\u4e00&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/www.bengbu.host\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bengbu.host\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bengbu.host\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bengbu.host\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bengbu.host\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":1,"href":"https:\/\/www.bengbu.host\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/www.bengbu.host\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/www.bengbu.host\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bengbu.host\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bengbu.host\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}