{"id":445,"date":"2011-01-28T00:30:38","date_gmt":"2011-11-17T05:51:50","guid":{"rendered":"http:\/\/kraftek.com\/blog\/better-searches-in-s9y\/"},"modified":"2011-01-28T00:30:38","modified_gmt":"2011-11-17T05:51:50","slug":"better-searches-in-s9y","status":"publish","type":"post","link":"\/blog\/index.php\/better-searches-in-s9y\/","title":{"rendered":"Better searches in s9y"},"content":{"rendered":"<p>mysql limits you by default to search for strings no smaller than 3 characters, so, if i wanted to look for &#8220;dd&#8221; in<br \/>\ns9y i had no luck.<br \/>\nF*n grep is better than mysql with that &gt; 3 chars limit.<br \/>\ns9y also uses MATCH and AGAINST which makes searches a bit dumb.<br \/>\nTo overcome this i added the parameter &#8220;&#8211;ft_min_word_len=1&#8221; to mysql startup, so we can search strings<br \/>\nshorter than 3 chars.<br \/>\n\/usr\/bin\/mysqld_safe &#8211;ft_min_word_len=1 &#8211;datadir=\/var\/lib\/mysql &#8211;pid-file=\/var\/run\/mysql\/mysql. pid $SKIP &amp;<br \/>\nTo make ft_min_word_len take effect you have to reindex the tables you wish to search with less than 3<br \/>\nchars. To do it:<br \/>\nmysql&gt; repair table serendipity_entries quick;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\n| Table | Op | Msg_type | Msg_text |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\n| serendipity.serendipity_entries | repair | status | OK |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\n1 row in set (0.20 sec)<br \/>\nmysql&gt; repair table serendipity_authors quick;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\n| Table | Op | Msg_type | Msg_text |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\n| serendipity.serendipity_authors | repair | status | OK |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\n1 row in set (0.00 sec)<br \/>\nmysql&gt; repair table serendipity_entrycat quick;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\n| Table | Op | Msg_type | Msg_text |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\n| serendipity.serendipity_entrycat | repair | status | OK |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+<br \/>\naround line 773 of s9y include\/functions_entries.inc.php we changed MATCH and AGAINST for LIKE<br \/>\n\/\/&#8211; rdircio, better searches here<br \/>\n\/\/ $cond[&#8216;find_part&#8217;] = &#8220;MATCH(title,body,extended) AGAINST(&#8216;$term&#8217; IN BOOLEAN MODE)&#8221;;<br \/>\n50\/433<br \/>\n$cond[&#8216;find_part&#8217;] = &#8220;(title LIKE &#8216;%$term%&#8217; OR body LIKE &#8216;%$term%&#8217; OR extended LIKE<br \/>\n&#8216;%$term%&#8217;)&#8221;;<br \/>\n} else {<br \/>\n\/\/ $cond[&#8216;find_part&#8217;] = &#8220;MATCH(title,body,extended) AGAINST(&#8216;$term&#8217;) &#8220;;<br \/>\n$cond[&#8216;find_part&#8217;] = &#8220;(title LIKE &#8216;%$term%&#8217; OR body LIKE &#8216;%$term%&#8217; OR extended LIKE<br \/>\n&#8216;%$term%&#8217;)&#8221;;<br \/>\n}<br \/>\nNow, you can enter text in the quicksearch like &#8221; tar c &#8221; at this blog and it will find entries like &#8221; tar cvf&#8221; and not<br \/>\nentries like &#8220;start&#8221;<br \/>\n51\/433<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mysql limits you by default to search for strings no smaller than 3 characters, so, if i wanted to look for &#8220;dd&#8221; in s9y i had no luck. F*n grep is better than mysql with that &gt; 3 chars limit. s9y also uses MATCH and AGAINST which makes searches a bit dumb. To overcome this [&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-445","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=445"}],"version-history":[{"count":0,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/445\/revisions"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=445"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}