Open airolg opened 6 years ago
This is expected. The facets sort/group on the result set produced by the match/scan/filter of the main query and they use same settings as the main query. This means each FACET respect the main query settings, including the max_matches
(how much space to allocate for each group).
The LIMIT of facets only control the number of groups (facet rows) that are returned back in the result.
I can see the problem here as it is tried to do a dynamic max_matches. However if facets are involved, there should be forced a minimum value good enough for carry the groups of any facets, so something like
$query->option('max_matches', (($offset+$page_size>$min_groups)?$offset+$page_size: $min_groups ));
where $min_groups would be 100 or 500 etc., depending on the expressions/facets that are expected to be used.
From Manticore forum: https://forum.manticoresearch.com/t/facet-return-null-row/95/6
Just found another bug, in sphinxsearch I was using dynamic max_matches:
$query->limit($offset, $page_size); if($offset+$page_size>0) $query->option('max_matches', $offset+$page_size);
All good, except that this max_matches is applied to facet and it shouldn’t. For facet I used to limit by FACET package LIMIT X