Fatih Kahveci
Fatih Kahveci

Reputation: 440

Sphinx duplicate document id pairs found

I have little problem duplicate index.

sql_query = SELECT id, title, file_id as table_id, "0" as description, "0" as content, "file" as type FROM language_files  UNION ALL \
            SELECT id, title, id as table_id, "0" as description, "0" as content, "list" as type FROM file_lists UNION ALL \
            SELECT id, title, id as table_id, description, "0" as content, "tip" as type FROM tips UNION ALL \
            SELECT id, title, id as table_id, "0" as description, content, "question" as type FROM questions 

This code belove my sphinx config. If matching questions.id and files.id same then Sphnix return question instance. Any idea?

Upvotes: 1

Views: 729

Answers (1)

Ar2r
Ar2r

Reputation: 138

You should use this query:

sql_query = SELECT ((id<<3)+1) as id, title, file_id as table_id, "0" as description, "0" as content, "file" as type FROM language_files  UNION ALL \
        SELECT ((id<<3)+2) as id, title, id as table_id, "0" as description, "0" as content, "list" as type FROM file_lists UNION ALL \
        SELECT ((id<<3)+3) as id, title, id as table_id, description, "0" as content, "tip" as type FROM tips UNION ALL \
        SELECT ((id<<3)+4) as id, title, id as table_id, "0" as description, content, "question" as type FROM questions 

It will generate different id for different tables.

Upvotes: 2

Related Questions