diff --git a/docs/query-language.md b/docs/query-language.md index 5400c8ead..93ddb846a 100644 --- a/docs/query-language.md +++ b/docs/query-language.md @@ -341,6 +341,13 @@ have the attribute specified by `field` with one of the values specified in **Result Type:** array of key/count objects +**Caveats:** +* Performing a TopN() query on a frame with cache type ranked will return the top bitmaps sorted by count in descending order. +* Frames with cache type lru will maintain an LRU (Least Recently Used) cache, thus a TopN() query on this type of frame will return bitmaps sorted in order of most recently set bit. +* The frame's cache size determines the number of sorted bitmaps to maintain in the cache for purposes of TopN() queries. There is a tradeoff between performance and accuracy; increasing the cache size will improve accuracy of results at the cost of performance. +* Once full, the cache will truncate the set of bitmaps according to the frame option CacheSize. Bitmaps that straddle the limit and have the same count will be truncated in no particular order. +* The TopN() query's attribute filter is applied to the existing sorted cache of bitmaps. Bitmaps that fall outside of the sorted cache range, even if they would normally pass the filter, are ignored. + **Examples:** ```