Когда я использую синтаксис GROUP BY в Manticore, появляются результаты с дублированным сгруппированным идентификатором. Мы только что перешли с sphinx 2.X на последнюю версию Manticore, и в Sphinx не было этой проблемы с тем же запросом.
Это запрос sphinxQL:
SELECT model_id, model_root, model_name FROM search WHERE model_id != 0 GROUP BY model_root WITHIN GROUP ORDER BY model_level ASC ORDER BY model_level ASC, model_occurrence DESC, model_name ASC LIMIT 0, 13
Так сгруппирована модель_ root, и есть дублированный ключ в -> 10,11 (Cannon) -> Это не то, что я ожидал.
Это результат:
array:13 [▼
0 => array:3 [▼
"model_id" => "62763"
"model_root" => "62763"
"model_name" => "HP"
]
1 => array:3 [▼
"model_id" => "72771"
"model_root" => "72771"
"model_name" => "Sony"
]
2 => array:3 [▼
"model_id" => "72524"
"model_root" => "72524"
"model_name" => "Compaq"
]
3 => array:3 [▼
"model_id" => "62783"
"model_root" => "62783"
"model_name" => "Samsung"
]
4 => array:3 [▼
"model_id" => "62760"
"model_root" => "62760"
"model_name" => "Asus"
]
5 => array:3 [▼
"model_id" => "62761"
"model_root" => "62761"
"model_name" => "Toshiba"
]
6 => array:3 [▼
"model_id" => "85086"
"model_root" => "85086"
"model_name" => "Panasonic"
]
7 => array:3 [▼
"model_id" => "151763"
"model_root" => "151763"
"model_name" => "Acer"
]
8 => array:3 [▼
"model_id" => "72548"
"model_root" => "72548"
"model_name" => "Packard Bell"
]
9 => array:3 [▼
"model_id" => "62762"
"model_root" => "62762"
"model_name" => "Lenovo"
]
10 => array:3 [▼
"model_id" => "83072"
"model_root" => "83072"
"model_name" => "Canon"
]
11 => array:3 [▼
"model_id" => "83072"
"model_root" => "83072"
"model_name" => "Canon"
]
12 => array:3 [▼
"model_id" => "73476"
"model_root" => "73476"
"model_name" => "LG"
]
]
Что ожидается:
array:13 [▼
0 => array:3 [▼
"model_id" => "62763"
"model_root" => "62763"
"model_name" => "HP"
]
1 => array:3 [▼
"model_id" => "72771"
"model_root" => "72771"
"model_name" => "Sony"
]
2 => array:3 [▼
"model_id" => "72524"
"model_root" => "72524"
"model_name" => "Compaq"
]
3 => array:3 [▼
"model_id" => "62783"
"model_root" => "62783"
"model_name" => "Samsung"
]
4 => array:3 [▼
"model_id" => "62760"
"model_root" => "62760"
"model_name" => "Asus"
]
5 => array:3 [▼
"model_id" => "62761"
"model_root" => "62761"
"model_name" => "Toshiba"
]
6 => array:3 [▼
"model_id" => "85086"
"model_root" => "85086"
"model_name" => "Panasonic"
]
7 => array:3 [▼
"model_id" => "151763"
"model_root" => "151763"
"model_name" => "Acer"
]
8 => array:3 [▼
"model_id" => "72548"
"model_root" => "72548"
"model_name" => "Packard Bell"
]
9 => array:3 [▼
"model_id" => "62762"
"model_root" => "62762"
"model_name" => "Lenovo"
]
10 => array:3 [▼
"model_id" => "83072"
"model_root" => "83072"
"model_name" => "Canon"
]
11 => array:3 [▼
"model_id" => "73476"
"model_root" => "73476"
"model_name" => "LG"
]
12 => array:3 [▼
"model_id" => "73266"
"model_root" => "73266"
"model_name" => "Fujitsu"
]
]
Это определение индекса:
index search
{
type = plain
source = search
path = /var/lib/manticore/data/search
min_word_len = 1
dict = keywords
min_prefix_len = 1
index_field_lengths = 1
charset_table = 0..9,non_cjk,-,.,/,"
}
и в определении источника обязательные поля:
sql_attr_uint = model_id
sql_attr_uint = model_root
sql_field_string = model_name
Есть идеи, в чем проблема с определением запроса или индекса?