Sphinx ODBC FreeTDS "duplicate document ids found"
Posted May 21 2010, 06:46 by William Shallum [updated Oct 2 2014, 08:21]
Don’t:
SELECT id, SomeField FROM SomeTable
Do:
SELECT CAST(id AS VARCHAR(20)), SomeField FROM SomeTable
Reason is because id is returned as an integer with size 4 (32-bit integer?) according to SQLDescribeCol, but sphinx uses this size to create a buffer with size 5 (4 bytes + 1 null terminator). This then fetches only the first four numbers of the ID, leading to “duplicate document ids found” messages if you have e.g. IDs 10001 and 10002.