{"id":49705,"date":"2024-12-03T16:18:37","date_gmt":"2024-12-03T08:18:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/49705\/"},"modified":"2024-12-03T16:18:37","modified_gmt":"2024-12-03T08:18:37","slug":"%e5%9c%a8-orator-orm-%e4%b8%ad%e5%a6%82%e4%bd%95%e6%9e%84%e9%80%a0%e5%a4%9a%e4%b8%aa-like-%e6%9f%a5%e8%af%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/49705\/","title":{"rendered":"\u5728 Orator ORM \u4e2d\u5982\u4f55\u6784\u9020\u591a\u4e2a LIKE \u67e5\u8be2\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5728 Orator ORM \u4e2d\u5982\u4f55\u6784\u9020\u591a\u4e2a LIKE \u67e5\u8be2\uff1f<\/h1>\n<p>\u5c0f\u4f19\u4f34\u4eec\u6709\u6ca1\u6709\u89c9\u5f97\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u5f88\u6709\u610f\u601d\uff1f\u6709\u610f\u601d\u5c31\u5bf9\u4e86\uff01\u4eca\u5929\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5728 Orator ORM \u4e2d\u5982\u4f55\u6784\u9020\u591a\u4e2a LIKE \u67e5\u8be2\uff1f\u300b<\/span>\uff0c\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\uff0c\u82e5\u662f\u5728\u5b66\u4e60\u4e2d\u5bf9\u5176\u4e2d\u90e8\u5206\u77e5\u8bc6\u70b9\u6709\u7591\u95ee\uff0c\u6216\u8bb8\u770b\u4e86\u672c\u6587\u5c31\u80fd\u5e2e\u5230\u4f60\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241101\/17304543546724a352b0701.jpg\" class=\"aligncenter\" title=\"\u5728 Orator ORM \u4e2d\u5982\u4f55\u6784\u9020\u591a\u4e2a LIKE \u67e5\u8be2\uff1f\u63d2\u56fe\" alt=\"\u5728 Orator ORM \u4e2d\u5982\u4f55\u6784\u9020\u591a\u4e2a LIKE \u67e5\u8be2\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 python \u7684 orator orm \u4e2d\u6784\u9020\u591a\u4e2a like \u67e5\u8be2<\/strong><\/p>\n<p>orator orm \u4e2d\u6ca1\u6709\u63d0\u4f9b\u76f4\u63a5\u652f\u6301\u591a\u4e2a like \u67e5\u8be2\u7684\u65b9\u6cd5\u3002\u4f46\u662f\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u8d4b\u503c\u7684\u65b9\u6cd5\u6765\u5b9e\u73b0\u3002<\/p>\n<p><strong>and \u903b\u8f91\u64cd\u4f5c<\/strong><\/p>\n<p>\u5982\u679c\u9700\u8981\u591a\u4e2a\u5173\u952e\u8bcd\u6ee1\u8db3 and \u6761\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre># \u5b9e\u73b0 and \u903b\u8f91\nsearch = ['%word1%', '%word2%', '%word3%', ...]\ninfo = db.table('full_text')\nfor s in search:\n    info = info.where('title', 'like', s)\nresult = info.get()<\/pre>\n<p><strong>or \u903b\u8f91\u64cd\u4f5c<\/strong><\/p>\n<p>\u5982\u679c\u9700\u8981\u591a\u4e2a\u5173\u952e\u8bcd\u6ee1\u8db3 or \u6761\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre># \u5b9e\u73b0 OR \u903b\u8f91\nsearch = ['%word1%', '%word2%', '%word3%', ...]\ninfo = DB.table('full_text')\nfor s in search:\n    if search.index(s) == 0:\n        info = info.where('title', 'like', s)\n    else:\n        info = info.or_where('title', 'like', s)\nresult = info.get()<\/pre>\n<p>\u867d\u7136 orator orm \u5728\u6784\u9020\u591a\u4e2a like \u67e5\u8be2\u65b9\u9762\u4e0d\u662f\u7279\u522b\u65b9\u4fbf\uff0c\u4f46\u4f7f\u7528\u4e0a\u8ff0\u65b9\u6cd5\u53ef\u4ee5\u5b9e\u73b0\u7c7b\u4f3c\u7684\u6548\u679c\u3002<\/p>\n<p>\u6587\u4e2d\u5173\u4e8e\u7684\u77e5\u8bc6\u4ecb\u7ecd\uff0c\u5e0c\u671b\u5bf9\u4f60\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff01\u82e5\u662f\u53d7\u76ca\u532a\u6d45\uff0c\u90a3\u5c31\u52a8\u52a8\u9f20\u6807\u6536\u85cf\u8fd9\u7bc7\u300a\u5728 Orator ORM \u4e2d\u5982\u4f55\u6784\u9020\u591a\u4e2a LIKE \u67e5\u8be2\uff1f\u300b\u6587\u7ae0\u5427\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u4e86\u89e3\u76f8\u5173\u6280\u672f\u6587\u7ae0\u3002<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1aphp \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Orator ORM \u4e2d\u5982\u4f55\u6784\u9020\u591a\u4e2a LIKE \u67e5\u8be2\uff1f \u5c0f\u4f19\u4f34\u4eec\u6709\u6ca1\u6709\u89c9\u5f97\u5b66\u4e60\u6587\u7ae0\u5f88\u6709\u610f\u601d\uff1f\u6709\u610f\u601d\u5c31\u5bf9\u4e86\uff01\u4eca\u5929\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765\u300a\u5728 Orator ORM \u4e2d\u5982\u4f55\u6784\u9020\u591a\u4e2a LIKE \u67e5\u8be2\uff1f\u300b\uff0c\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230\uff0c\u82e5\u662f\u5728\u5b66\u4e60\u4e2d\u5bf9\u5176\u4e2d\u90e8\u5206\u77e5\u8bc6\u70b9\u6709\u7591\u95ee\uff0c\u6216\u8bb8\u770b\u4e86\u672c\u6587\u5c31\u80fd\u5e2e\u5230\u4f60\uff01 \u5982\u4f55\u5728 python \u7684 orator orm \u4e2d\u6784\u9020\u591a\u4e2a like \u67e5\u8be2 orator orm \u4e2d\u6ca1\u6709\u63d0\u4f9b\u76f4\u63a5\u652f\u6301\u591a\u4e2a like \u67e5\u8be2\u7684\u65b9\u6cd5\u3002\u4f46\u662f\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u8d4b\u503c\u7684\u65b9\u6cd5\u6765\u5b9e\u73b0\u3002 and \u903b\u8f91\u64cd\u4f5c \u5982\u679c\u9700\u8981\u591a\u4e2a\u5173\u952e\u8bcd\u6ee1\u8db3 and \u6761\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a # \u5b9e\u73b0 and \u903b\u8f91 search = [&#8216;%word1%&#8217;, &#8216;%word2%&#8217;, &#8216;%word3%&#8217;, &#8230;] info = db.table(&#8216;full_text&#8217;) for s in search: info = info.where(&#8216;title&#8217;, &#8216;like&#8217;, s) result = info.get() [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-49705","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=49705"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49705\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=49705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=49705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=49705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}