sphinx search 2.2.11 – column count does not match schema (expected 3, got 2)

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(?,?)… until the day i’ve upgraded to 2.2.11. the update command started to give me:

mysql> REPLACE INTO myrt VALUES(2, '1');
ERROR 1064 (42000): column count does not match schema (expected 3, got 2)

after a bit of investigation i’ve discovered that:

  • with RT index it’s obligatory to have at least one attribute [not id], even if you dont use it – https://github.com/sphinxsearch/sphinx/pull/14
  • calling the attribute id was unfortunate, so i’ve renamed it to garbage: rt_attr_uint = garbage
  • the new REPLACE INTO command should look like this: REPLACE INTO myrt(id,content) VALUES(2, ‘1’); or REPLACE INTO myrt(id,content,garbage) VALUES(2, ‘1’,0); where the last value is ‘garbage’ attribute to be ignored.

Leave a Reply

Your email address will not be published. Required fields are marked *

(Spamcheck Enabled)