Random Notes‎ > ‎

Sphinx ODBC FreeTDS "duplicate document ids found"

posted May 20, 2010, 11:46 PM by William Shallum   [ updated Oct 2, 2014, 1:21 AM ]
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.
Comments