{"id":277,"date":"2021-11-18T15:32:59","date_gmt":"2021-11-18T15:32:59","guid":{"rendered":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/?p=277"},"modified":"2021-11-18T15:32:59","modified_gmt":"2021-11-18T15:32:59","slug":"match-against","status":"publish","type":"post","link":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/18\/match-against\/","title":{"rendered":"MATCH&#8230;AGAINST"},"content":{"rendered":"\n<p>The MATCH\u2026AGAINST construct can be used on columns that have been given a FULL TEXT index. With it, you can make own-language searches as you would in an internet search engine.<br>Unlike the use of WHERE\u2026= or WHERE\u2026LIKE, MATCH\u2026AGAINST lets you enter multiple words in a search query and checks them against all words in the FULLTEXT columns. FULLTEXT indexes are case-insensitive, so it makes no difference what case is used in your queries.<\/p>\n\n\n\n<p>Assuming that you have added a FULLTEXT index to the author and title columns, enter the three queries. The first asks for any rows that contain<br>the word and to be returned. Because and is a stopword, MySQL will ignore it and the query will always produce an empty set\u2014no matter what is stored in the columns. The second query asks for any rows that contain both of the words curiosity and shop anywhere in them, in any order, to be returned. And the last query applies the same kind of search for the words Aro and Markku. <\/p>\n\n\n\n<p>Using MATCH\u2026AGAINST on FULLTEXT indexes:<br><\/p>\n\n\n\n<p>SELECT author,title FROM classics<br>WHERE MATCH(author,title) AGAINST(&#8217;30&#8217;);<br>SELECT author,title FROM classics<br>WHERE MATCH(author,title) AGAINST(&#8216;kautta aikain&#8217;);<br>SELECT author,title FROM classics<br>WHERE MATCH(author,title) AGAINST(&#8216;parhaat&#8217;);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The MATCH\u2026AGAINST construct can be used on columns that have been given a FULL TEXT index. With it, you can make own-language searches as you would in an internet search engine.Unlike the use of WHERE\u2026= or WHERE\u2026LIKE, MATCH\u2026AGAINST lets you enter multiple words in a search query and checks them against all words in the &hellip; <a href=\"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/18\/match-against\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">MATCH&#8230;AGAINST<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/277"}],"collection":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=277"}],"version-history":[{"count":1,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/277\/revisions"}],"predecessor-version":[{"id":278,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/277\/revisions\/278"}],"wp:attachment":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}