Open cpm828 opened 7 years ago
What are u talking about? U want to hide search, but still use it or what?
how to fuzzy search with local search 发自Pimi的iPhone7 Plus On 06/03/2017 16:10, Ivan.Nginx wrote: What are u talking about? U want to hide search, but still use it or what?
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/iissnan/hexo-theme-next","title":"iissnan/hexo-theme-next","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/iissnan/hexo-theme-next"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ivan-nginx in #1695: What are u talking about? U want to hide search, but still use it or what?"}],"action":{"name":"View Issue","url":"https://github.com/iissnan/hexo-theme-next/issues/1695#issuecomment-305959821"}}}
Don't understand u. What u want? Fuzzy?
模糊查找 U translate 发自Pimi的iPhone7 Plus On 06/03/2017 16:16, Ivan.Nginx wrote: Don't understand u. What u want? Fuzzy?
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/iissnan/hexo-theme-next","title":"iissnan/hexo-theme-next","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/iissnan/hexo-theme-next"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ivan-nginx in #1695: Don't understand u. What u want? Fuzzy?"}],"action":{"name":"View Issue","url":"https://github.com/iissnan/hexo-theme-next/issues/1695#issuecomment-305960152"}}}
Which kind of ambiguity. wildcards? regex? Anyway I don't see any necessity.
datas.forEach(function(data) { var isMatch = false; var content_index = []; var data_title = data.title.trim().toLowerCase(); var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase(); var data_url = decodeURIComponent(data.url); var index_title = -1; var index_content = -1; var first_occur = -1; // only match artiles with not empty titles and contents if(data_title != '') { keywords.forEach(function(keyword, i) { index_title = data_title.indexOf(keyword); index_content = data_content.indexOf(keyword); if( index_title >= 0 || index_content >= 0 ){ isMatch = true; if (i == 0) { first_occur = index_content; } } }); }
It's the code of local search, it is in line 47 in /themes/next/layout/_third-party/search/localsearch.swig. You can modify it by yourself, good luck.
thanks for your reply 发自Pimi的iPhone7 Plus On 06/18/2017 01:09, hiyforever wrote: datas.forEach(function(data) { var isMatch = false; var content_index = []; var data_title = data.title.trim().toLowerCase(); var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase(); var data_url = decodeURIComponent(data.url); var index_title = -1; var index_content = -1; var first_occur = -1; // only match artiles with not empty titles and contents if(data_title != '') { keywords.forEach(function(keyword, i) { index_title = data_title.indexOf(keyword); index_content = data_content.indexOf(keyword); if( index_title >= 0 || index_content >= 0 ){ isMatch = true; if (i == 0) { first_occur = index_content; } } }); } It's the code of local search, it is in line 47 in /themes/next/layout/_third-party/search/localsearch.swig. You can modify it by yourself, good luck.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/iissnan/hexo-theme-next","title":"iissnan/hexo-theme-next","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/iissnan/hexo-theme-next"}},"updates":{"snippets":[{"icon":"PERSON","message":"@hiyforever in #1695: \u003cpre\u003edatas.forEach(function(data) {\r\n var isMatch = false;\r\n var content_index = [];\r\n var data_title = data.title.trim().toLowerCase();\r\n var data_content = data.content.trim().replace(/\u003c[^\u003e]+\u003e/g,\"\").toLowerCase();\r\n var data_url = decodeURIComponent(data.url);\r\n var index_title = -1;\r\n var index_content = -1;\r\n var first_occur = -1;\r\n // only match artiles with not empty titles and contents\r\n if(data_title != '') {\r\n keywords.forEach(function(keyword, i) {\r\n index_title = data_title.indexOf(keyword);\r\n index_content = data_content.indexOf(keyword);\r\n if( index_title \u003e= 0 || index_content \u003e= 0 ){\r\n isMatch = true;\r\n if (i == 0) {\r\n first_occur = index_content;\r\n }\r\n }\r\n });\r\n }\u003c/pre\u003e\r\nIt's the code of local search, it is in line 47 in /themes/next/layout/_third-party/search/localsearch.swig.\r\nYou can modify it by yourself, good luck."}],"action":{"name":"View Issue","url":"https://github.com/iissnan/hexo-theme-next/issues/1695#issuecomment-309227610"}}}
local search How to obscure lookup
local search搜索如何支持模糊查找,具体如何修改