{"id":2672,"date":"2016-09-07T09:59:53","date_gmt":"2016-09-07T08:59:53","guid":{"rendered":"http:\/\/kudzia.eu\/b\/?p=2672"},"modified":"2016-09-07T09:59:53","modified_gmt":"2016-09-07T08:59:53","slug":"sphinx-search-2-2-11-column-count-does-not-match-schema-expected-3-got-2","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2016\/09\/sphinx-search-2-2-11-column-count-does-not-match-schema-expected-3-got-2\/","title":{"rendered":"sphinx search 2.2.11 &#8211; column count does not match schema (expected 3, got 2)"},"content":{"rendered":"<p>i have a real-time sphinx that was configured in this way:\\<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nindex myrt{\r\nhitless_words = all\r\ndict=keywords\r\ntype = rt\r\nrt_attr_uint = id\r\nrt_field = content\r\n}\r\n<\/pre>\n<p>it was updated using <i>REPLACE INTO myrt VALUES(?,?)<\/i>&#8230; until the day i&#8217;ve upgraded to 2.2.11. the update command started to give me:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmysql&gt; REPLACE INTO myrt VALUES(2, '1');\r\nERROR 1064 (42000): column count does not match schema (expected 3, got 2)\r\n<\/pre>\n<p>after a bit of investigation i&#8217;ve discovered that:<\/p>\n<ul>\n<li>with RT index it&#8217;s obligatory to have at least one attribute [not id], even if you dont use it &#8211; https:\/\/github.com\/sphinxsearch\/sphinx\/pull\/14<\/li>\n<li>calling the attribute <i>id<\/i> was unfortunate, so i&#8217;ve renamed it to <i>garbage<\/i>: <i>rt_attr_uint = garbage<\/i><\/li>\n<li>the new REPLACE INTO command should look like this: <i>REPLACE INTO myrt(id,content) VALUES(2, &#8216;1&#8217;);<\/i> or <i>REPLACE INTO myrt(id,content,garbage) VALUES(2, &#8216;1&#8217;,0);<\/i> where the last value is &#8216;garbage&#8217; attribute to be ignored.\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>i have a real-time sphinx that was configured in this way:\\ index myrt{ hitless_words = all dict=keywords type = rt rt_attr_uint = id rt_field = content } it was updated using REPLACE INTO myrt VALUES(?,?)&#8230; until the day i&#8217;ve upgraded to 2.2.11. the update command started to give me: mysql&gt; REPLACE INTO myrt VALUES(2, &#8216;1&#8217;); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,51],"tags":[44],"class_list":["post-2672","post","type-post","status-publish","format-standard","hentry","category-tech","category-unimportant","tag-sphinx-search"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/2672","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=2672"}],"version-history":[{"count":1,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/2672\/revisions"}],"predecessor-version":[{"id":2673,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/2672\/revisions\/2673"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=2672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=2672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=2672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}