{"id":3517,"date":"2018-12-10T17:39:16","date_gmt":"2018-12-10T09:39:16","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3517"},"modified":"2018-12-10T17:39:16","modified_gmt":"2018-12-10T09:39:16","slug":"lucene-%e5%ae%9e%e6%88%98%e6%95%99%e7%a8%8b%e7%ac%ac%e4%b8%80%e7%ab%a0-lucene-%e7%ae%80%e4%bb%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3517","title":{"rendered":"Lucene \u5b9e\u6218\u6559\u7a0b\u7b2c\u4e00\u7ae0 Lucene \u7b80\u4ecb"},"content":{"rendered":"<p>\n\tLucene \u8fd1\u5e74\u6765\u8d8a\u6765\u8d8a\u706b\uff0c\u7535\u5546\u9879\u76ee\u57fa\u672c\u4e0a\u90fd\u6709\u4f7f\u7528\u3002\u6700\u8fd1\u6211\u5728\u4f18\u5316\u4e00\u4e9b\u516c\u53f8\u5185\u90e8\u7684\u7cfb\u7edf\uff0c\u5176\u4e2d\u5728\u641c\u7d22\u6a21\u5757\uff0c\u6211\u6253\u7b97\u4f7f\u7528 Lucene \u53d6\u4ee3\u539f\u6765\u7684\u57fa\u4e8e SQL \u5f62\u5f0f\u7684\u641c\u7d22\u3002\u672c\u6587\u7b97\u662f Lucene\u4e2d\u6587\u6559\u7a0b\u7684\u7b2c\u4e00\u7ae0\uff0c\u8ba4\u8bc6 Lucene\uff0c\u548c\u5b83\u7684\u4e00\u4e9b\u6838\u5fc3\u7c7b\u4ecb\u7ecd\u3002\n<\/p>\n<p>\n\t\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u6211\u5728\u767e\u5ea6\u4e0a\u641c\u7d22\u4e86 Lucene\uff0c\u53d1\u73b0\u4e0b\u9762\u7684\u8fd9\u4e9b\u5173\u952e\u8bcd\u6bd4\u8f83\u706b\uff1a\n<\/p>\n<p>\n\tucene\u548csolr\u7684\u533a\u522b&nbsp;&nbsp; &nbsp;\u3001Lucene\u9762\u8bd5\u9898\u3001elasticsearch\u3001Lucene netcore\u3001Lucene\u600e\u4e48\u8bfb\u3001Lucene\u641c\u7d22\u3001Lucene\u7684\u540d\u5b57\u3001Lucene Spark\u3001Lucene \u539f\u6587\u6863\u3002\n<\/p>\n<p>\n\t\u5728\u8c37\u6b4c\u4e0a\u641c\u7d22 Lucene\uff0c\u53d1\u73b0\u4e0b\u9762\u8fd9\u4e9b\u5173\u952e\u8bcd\u6bd4\u8f83\u706b\uff1a\n<\/p>\n<p>\n\tlucene\u4ecb\u7ecd\u3001lucene github\u3001lucene\u4f7f\u7528\u3001lucene tutorial\u3001lucene\u6559\u7a0b\u3001lucene elasticsearch\u3001lucene document\u3001lucene solr\u3001lucene\u4e2d\u6587\u6559\u7a0b\u3001lucene jar\u3002\n<\/p>\n<p>\n\t\u7ecf\u7edf\u8ba1\u540e\uff0c\u53d1\u73b0\u7f51\u4e0a\u8fd8\u662f\u7f3a\u5c11\u4e00\u4e9b Lucene \u65b9\u9762\u7684\u6559\u7a0b\u8d44\u6599\u3002\u800c\u4e14 Lucene \u65b9\u9762\u7684\u641c\u7d22\u6307\u6570\u5728\u9010\u6e10\u589e\u9ad8\uff0c\u56e0\u6b64\u6211\u60f3\u5bf9 Lucene \u5199\u4e00\u4e2a\u6559\u7a0b\u96c6\u5408\uff0c\u65b9\u4fbf\u5927\u5bb6\u5b66\u4e60\uff01\n<\/p>\n<p>\n\t\u76f8\u4fe1\u5927\u591a\u6570\u516c\u53f8\u7684\u6570\u636e\u5e93\u90fd\u9700\u8981\u91c7\u7528\u5206\u5e93\u5206\u8868\u7b49\u4e00\u4e9b\u7b56\u7565\uff0c\u800c\u5bf9\u4e8e\u67d0\u4e9b\u7279\u5b9a\u7684\u4e1a\u52a1\u9700\u6c42\uff0c\u5206\u522b\u4ece\u4e0d\u540c\u7684\u5e93\u4e0d\u540c\u7684\u8868\u4e2d\u53bb\u68c0\u7d22\u7279\u5b9a\u7684\u6570\u636e\u663e\u5f97\u6bd4\u8f83\u7e41\u7410\uff0c\u800cLucene\u6b63\u597d\u53ef\u4ee5\u89e3\u51b3\u67d0\u4e9b\u7279\u6b8a\u9700\u6c42\uff0c\u5bf9\u4e8e\u4e0d\u540c\u5e93\u4e0d\u540c\u8868\u4e2d\u7684\u6570\u636e\u5148\u5efa\u7acb\u5168\u91cf\u7d22\u5f15\uff0c\u7136\u540e\u5c06\u9700\u8981\u68c0\u7d22\u7684\u6570\u636e\u5199\u5165\u67d0\u4e2a\u5355\u72ec\u7684\u8868\u4e2d\uff0c\u4f9b\u5176\u5b83\u4e1a\u52a1\u9700\u6c42\u65b9\u67e5\u8be2\uff0c\u4ee5\u540e\u7684\u6bcf\u5929\u53ea\u9700\u8981\u505a\u589e\u91cf\u7d22\u5f15\u5e76\u5199\u5165\u6570\u636e\u8868\u5373\u53ef\u3002\n<\/p>\n<p>\n\tLucene\u662f\u4e00\u4e2a\u9ad8\u6548\u7684\uff0c\u57fa\u4e8eJava\u7684\u5168\u6587\u68c0\u7d22\u5e93\uff0c\u751f\u6d3b\u4e2d\u6570\u636e\u4e3b\u8981\u5206\u4e3a\u4e24\u79cd\uff1a\u7ed3\u6784\u5316\u6570\u636e\u548c\u975e\u7ed3\u6784\u5316\u6570\u636e\u3002\u4e00\u822c\u4f7f\u7528\u7684XML\u3001JSON\u3001\u6570\u636e\u5e93\u7b49\u90fd\u662f\u7ed3\u6784\u5316\u6570\u636e\uff0c\u975e\u7ed3\u6784\u5316\u6570\u636e\u4e5f\u53eb\u5168\u6587\u6570\u636e\uff0c\u800c\u8fd9\u79cd\u5168\u6587\u6570\u636e\u6b63\u662fLucene\u7684\u7528\u6b66\u4e4b\u5730\u3002\u5168\u6587\u68c0\u7d22\u4e3b\u8981\u6709\u4e24\u4e2a\u8fc7\u7a0b\uff0c\u7d22\u5f15\u521b\u5efa\uff08Indexing\uff09\u548c\u641c\u7d22\u7d22\u5f15\uff08Search\uff09\u3002\n<\/p>\n<p>\n\tLucene \u7684\u7279\u70b9\u6709\u5f88\u591a\uff0c\u6211\u4ece\u7f51\u4e0a\u627e\u4e86\u4e0b\u9762\u51e0\u4e2a\u65b9\u4fbf\u5927\u5bb6\u8ba4\u8bc6\uff1a\n<\/p>\n<ul>\n<li>\n\t\t\u5728\u73b0\u4ee3\u7684\u786c\u4ef6\u4e0a\u4e00\u5c0f\u65f6\u53ef\u4ee5\u7d22\u5f15150GB\u7684\u6570\u636e\n\t<\/li>\n<li>\n\t\t\u7d22\u5f1520GB\u7684\u6587\u672c\u6587\u4ef6\uff0c\u4ea7\u751f\u7684\u7d22\u5f15\u6587\u4ef6\u5927\u6982\u662f4-6GB\n\t<\/li>\n<li>\n\t\t\u53ea\u9700\u89811MB\u7684\u5806\u5185\u5b58\n\t<\/li>\n<li>\n\t\t\u53ef\u5b9a\u5236\u7684\u6392\u5e8f\u6a21\u578b\n\t<\/li>\n<li>\n\t\t\u652f\u6301\u591a\u79cd\u67e5\u8be2\u7c7b\u578b\n\t<\/li>\n<li>\n\t\t\u901a\u8fc7\u7279\u5b9a\u7684\u5b57\u6bb5\u641c\u7d22\n\t<\/li>\n<li>\n\t\t\u901a\u8fc7\u7279\u5b9a\u7684\u5b57\u6bb5\u6392\u5e8f\n\t<\/li>\n<li>\n\t\t\u8fd1\u5b9e\u65f6\u7684\u7d22\u5f15\u548c\u641c\u7d22\n\t<\/li>\n<li>\n\t\tFaceting\uff0cGrouping\uff0cHighlighting\uff0cSuggestions\u7b49\n\t<\/li>\n<\/ul>\n<p>\n\t\u57fa\u4e8e Lucene \u7684\u641c\u7d22\u6280\u672f\uff0c\u4ea7\u751f\u4e86\u4e24\u4e2a\u5927\u5bb6\u975e\u5e38\u719f\u6089\u7684\u6d41\u884c\u6846\u67b6\uff1aApache Solr \u548c Elastic search\u3002\u4ee5\u53ca\u4e00\u4e9b\u5176\u4ed6\u8bed\u8a00\u5bf9 Lucene \u7684\u5b9e\u73b0\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u5404\u79cd\u8bed\u8a00\u5b9e\u73b0\u7684 Lucene \u6846\u67b6\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/lucene-language-realize.png\" style=\"width: 825px;height: 573px\" \/>\n<\/p>\n<p>\n\tLucene \u641c\u7d22\u6280\u672f\uff0c\u6700\u91cd\u8981\u7684\u90e8\u5206\u5c31\u662f\u7d22\u5f15\u3002\u53ef\u4ee5\u8bf4\u6240\u6709\u7684\u641c\u7d22\u6280\u672f\u90fd\u662f\u57fa\u4e8e\u7d22\u5f15\u7684\uff0c\u5305\u62ec\u6570\u636e\u5e93\u7d22\u5f15\u3002\n<\/p>\n<p>\n\tLucene \u7684\u7d22\u5f15\u4e00\u822c\u662f\u521b\u5efa\u5e76\u5b58\u50a8\u5728\u6587\u4ef6\u7cfb\u7edf\u4e4b\u4e0a\u3002\u53ef\u4ee5\u662f\u672c\u5730\uff0c\u4e5f\u53ef\u4ee5\u662f\u8fdc\u7a0b\u6570\u636e\u5e93\u7b49\u3002Lucene \u5728\u6587\u4ef6\u7cfb\u7edf\u4e2d\u5b58\u50a8\u7d22\u5f15\u7684\u6700\u57fa\u672c\u7684\u62bd\u8c61\u5b9e\u73b0\u7c7b\u662f BaseDirectory\uff0c\u8be5\u7c7b\u7ee7\u627f\u81ea Directory\uff0cBaseDirectory \u6709\u4e24\u4e2a\u4e3b\u8981\u7684\u5b9e\u73b0\u7c7b\uff1a\n<\/p>\n<ul>\n<li>\n\t\tFSDirectory\uff1a\u5728\u6587\u4ef6\u7cfb\u7edf\u4e0a\u5b58\u50a8\u7d22\u5f15\u6587\u4ef6\uff0c\u6709\u516d\u4e2a\u5b50\u7c7b\uff0c\u5982\u4e0b\u662f\u4e09\u4e2a\u5e38\u7528\u7684\u5b50\u7c7b\uff1aSimpleFSDirectory\u3001NIOFSDirectory\u3001MMapDirectory\u3002\n\t<\/li>\n<li>\n\t\tRAMDirectory\uff1a\u5728\u5185\u5b58\u4e2d\u6682\u5b58\u7d22\u5f15\u6587\u4ef6\uff0c\u53ea\u5bf9\u5c0f\u7d22\u5f15\u597d\uff0c\u5927\u7d22\u5f15\u4f1a\u51fa\u73b0\u9891\u7e41GC\u3002\n\t<\/li>\n<\/ul>\n<h2>\n\tLucene \u91cc\u9762\u7684\u7d22\u5f15\u6838\u5fc3\u7c7b<br \/>\n<\/h2>\n<ul>\n<li>\n\t\tIndexWriter\uff1a\u8d1f\u8d23\u521b\u5efa\u7d22\u5f15\u6216\u6253\u5f00\u5df2\u6709\u7d22\u5f15\n\t<\/li>\n<li>\n\t\tIndexWriterConfig\uff1a\u6301\u6709\u521b\u5efaIndexWriter\u7684\u6240\u6709\u914d\u7f6e\u9879\n\t<\/li>\n<li>\n\t\tDirectory\uff1a\u63cf\u8ff0\u4e86Lucene\u7d22\u5f15\u7684\u5b58\u653e\u4f4d\u7f6e\uff0c\u5b83\u7684\u5b50\u7c7b\u8d1f\u8d23\u5177\u4f53\u6307\u5b9a\u7d22\u5f15\u7684\u5b58\u50a8\u8def\u5f84\n\t<\/li>\n<li>\n\t\tAnalyzer\uff1a\u8d1f\u8d23\u6587\u672c\u5206\u6790\uff0c\u4ece\u88ab\u7d22\u5f15\u6587\u672c\u6587\u4ef6\u4e2d\u63d0\u53d6\u51fa\u8bed\u6c47\u5355\u5143\u3002\u5bf9\u4e8e\u6587\u672c\u5206\u6790\u5668Analyzer\uff0c\u9700\u8981\u6ce8\u610f\u4e00\u70b9\uff0c\u5c31\u662f\u4f7f\u7528\u54ea\u79cdAnalyzer\u8fdb\u884c\u7d22\u5f15\u521b\u5efa\uff0c\u67e5\u8be2\u7684\u65f6\u5019\u4e5f\u8981\u4f7f\u7528\u54ea\u79cdAnalyzer\u67e5\u8be2\uff0c\u5426\u5219\u67e5\u8be2\u7ed3\u679c\u4e0d\u6b63\u786e\u3002\n\t<\/li>\n<li>\n\t\tDocument\uff1a\u4ee3\u8868\u4e00\u4e9b\u57df\uff08Field\uff09\u7684\u96c6\u5408\uff0c\u4f60\u53ef\u4ee5\u5c06Document\u5bf9\u8c61\u7406\u89e3\u4e3a\u865a\u62df\u6587\u6863-\u4f8b\u5982Web\u9875\u9762\u3001E-mail\u4fe1\u606f\u6216\u8005\u6587\u672c\u6587\u4ef6\n\t<\/li>\n<li>\n\t\tField\uff1a\u7d22\u5f15\u4e2d\u7684\u6bcf\u4e2a\u6587\u6863\u90fd\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u4e0d\u540c\u547d\u540d\u7684\u57df\uff0c\u6bcf\u4e2a\u57df\u90fd\u6709\u4e00\u4e2a\u57df\u540d\u548c\u5bf9\u5e94\u7684\u57df\u503c\n\t<\/li>\n<li>\n\t\tFieldType\uff1a\u63cf\u8ff0\u4e86Field\u7684\u5404\u79cd\u5c5e\u6027\uff0c\u5728\u4e0d\u4f7f\u7528\u67d0\u79cd\u5177\u4f53\u7684Field\u7c7b\u578b\uff08\u4f8b\u5982StringField\uff0cTextField\uff09\u65f6\u9700\u8981\u7528\u5230\u6b64\u7c7b\n\t<\/li>\n<\/ul>\n<h2>\n\tLucene \u7684\u4f7f\u7528\u573a\u666f<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t\u641c\u7d22\u5f15\u64ce\u3002\u4f8b\u5982\uff1a\u767e\u5ea6\u3001\u5fc5\u5e94\u3001\u8c37\u6b4c\u7b49\u3002\n\t<\/li>\n<li>\n\t\t\u7ad9\u5185\u641c\u7d22\uff0c\u6bd4\u5982\uff0c\u6211\u4e2a\u4eba\u7f51\u7ad9\u7684\u7ad9\u5185\u641c\u7d22\u3002\n\t<\/li>\n<li>\n\t\t\u6587\u4ef6\u7cfb\u7edf\u7684\u641c\u7d22\uff0c\u4f8b\u5982\uff0cwindow \u7cfb\u7edf\u4e2d\u7684\u641c\u7d22\u7b49\u3002\n\t<\/li>\n<li>\n\t\t\u5546\u54c1\u641c\u7d22\uff0c\u7535\u5546\u7cfb\u7edf\u7684\u5546\u54c1\u641c\u7d22\u3002\n\t<\/li>\n<li>\n\t\t\u5927\u578b\u7cfb\u7edf\u7684\u5206\u5e93\u5206\u8868\u641c\u7d22\n\t<\/li>\n<li>\n\t\t\u4e00\u4e9b\u8f6f\u4ef6\u7684\u5185\u90e8\u641c\u7d22\uff0c\u4f8b\u5982 Eclipse \u4e2d\u7684\u641c\u7d22\u7b49\u3002\n\t<\/li>\n<\/ul>\n<h2>\n\tLucene \u5168\u6587\u68c0\u7d22\u7684\u6d41\u7a0b<br \/>\n<\/h2>\n<p>\n\t<img decoding=\"async\" alt=\"Lucene \u5168\u6587\u68c0\u7d22\u7684\u6d41\u7a0b\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/lucene-index-process.png\" style=\"width: 721px;height: 620px\" \/>\n<\/p>\n<p>\n\t\u901a\u8fc7\u672c\u6587\uff0c\u5e0c\u671b\u5927\u5bb6\u5bf9 Lucene \u6709\u4e00\u4e2a\u5927\u6982\u7684\u8ba4\u8bc6\uff0c\u540e\u9762\u6211\u4eec\u7ee7\u7eed\u6df1\u5165\u5b66\u4e60 Lucene\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3517\">Lucene \u5b9e\u6218\u6559\u7a0b\u7b2c\u4e00\u7ae0 Lucene \u7b80\u4ecb<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>Lucene \u8fd1\u5e74\u6765\u8d8a\u6765\u8d8a\u706b\uff0c\u7535\u5546\u9879\u76ee\u57fa\u672c\u4e0a\u90fd\u6709\u4f7f\u7528\u3002\u6700\u8fd1\u6211\u5728\u4f18\u5316\u4e00\u4e9b\u516c\u53f8\u5185\u90e8\u7684\u7cfb\u7edf\uff0c\u5176\u4e2d\u5728\u641c\u7d22\u6a21\u5757\uff0c\u6211\u6253\u7b97\u4f7f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1652,1444,1446,1447,1448],"class_list":["post-3517","post","type-post","status-publish","format-standard","hentry","category-java","tag-elasticsearch","tag-lucene","tag-lucene-","tag-solrlucene"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3517"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3517\/revisions"}],"predecessor-version":[{"id":3518,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3517\/revisions\/3518"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}