;; search pagination — Haskell source fragment. Depends on rank.
;; Windows a ranked result list by offset/limit (offset >= length -> empty;
;; limit clamps to what remains).
;;   paginate    :: Int -> Int -> [DocId] -> [DocId]   (offset, limit)
;;   pageTfIdf   :: Int -> Int -> [Term] -> Index -> [DocId]
;;   pageBm25    :: Int -> Int -> Float -> Float -> [Term] -> Index -> [DocId]
;;   resultCount :: [Term] -> Index -> Int

(define
  search/page-src
  "paginate off lim docs = take lim (drop off docs)\npageTfIdf off lim ts idx = paginate off lim (rankTfIdf ts idx)\npageBm25 off lim k1 b ts idx = paginate off lim (rankBm25 k1 b ts idx)\nresultCount ts idx = length (rankTfIdf ts idx)\n")
