max_matches + count

Hi,

Does “option max_marches” needed for count(*) or sum(…) for a large number of rows?

Thank you

max_matches, is the equivalent to the rows in the resultset. ie the total_found. Not the number of rows within each group.

In effect it can only keep track of ‘max_matches’ number of counts/sums etc. it that many rows.

So if the search result has lens than max_matches rows(ie groups) then the sum/count will be accurate

If the number of rows (ie ‘total_found’) is above max_matches, then the counts/sums are NOT guaranteed to be accurate (they may be, but possibly not!)


So a query
SELECT category,COUNT(*) as count,SUM(points) as points FROM index GROUP BY category

should be accurate if the number of categories is below max_matches (default 1000). Regardless of the number of documents in each category.

BUt if there are more than 1000 categories, then the numbers might be under-counted.

Thank you for you explanation, but what about with a simple query like this:
SELECT COUNT(*) as count FROM index or SELECT SUM(points) as count FROM index

Well as there would only be 1 row in the result, and 1 is (much) less then 1000, it will be entirely accurate.

total_found will always be 1 on that type of query. Regardless of the number documents.

Thank you for the explanation.