@@ -462,8 +462,10 @@ mkAggregateSearch query mkSearchAggs = Search query Nothing Nothing (Just mkSear
462mkHighlightSearch :: Maybe Query -> Highlights -> Search
462mkHighlightSearch :: Maybe Query -> Highlights -> Search
463mkHighlightSearch query searchHighlights = Search query Nothing Nothing Nothing (Just searchHighlights) False 0 10
463mkHighlightSearch query searchHighlights = Search query Nothing Nothing Nothing (Just searchHighlights) False 0 10
465−-- | 'pageSearch' is a helper function that takes a search and assigns the page from and to
465+-- | 'pageSearch' is a helper function that takes a search and assigns the from
466−-- fields for the search.
466+-- and size fields for the search. The from parameter defines the offset
467+-- from the first result you want to fetch. The size parameter allows you to
468+-- configure the maximum amount of hits to be returned.
468-- >>> let query = QueryMatchQuery $ mkMatchQuery (FieldName "_all") (QueryString "haskell")
470-- >>> let query = QueryMatchQuery $ mkMatchQuery (FieldName "_all") (QueryString "haskell")
469-- >>> let search = mkSearch (Just query) Nothing
471-- >>> let search = mkSearch (Just query) Nothing
@@ -471,5 +473,8 @@ mkHighlightSearch query searchHighlights = Search query Nothing Nothing Nothing
471-- Search {queryBody = Just (QueryMatchQuery (MatchQuery {matchQueryField = FieldName "_all", matchQueryQueryString = QueryString "haskell", matchQueryOperator = Or, matchQueryZeroTerms = ZeroTermsNone, matchQueryCutoffFrequency = Nothing, matchQueryMatchType = Nothing, matchQueryAnalyzer = Nothing, matchQueryMaxExpansions = Nothing, matchQueryLenient = Nothing})), filterBody = Nothing, sortBody = Nothing, aggBody = Nothing, highlight = Nothing, trackSortScores = False, from = 0, size = 10}
473-- Search {queryBody = Just (QueryMatchQuery (MatchQuery {matchQueryField = FieldName "_all", matchQueryQueryString = QueryString "haskell", matchQueryOperator = Or, matchQueryZeroTerms = ZeroTermsNone, matchQueryCutoffFrequency = Nothing, matchQueryMatchType = Nothing, matchQueryAnalyzer = Nothing, matchQueryMaxExpansions = Nothing, matchQueryLenient = Nothing})), filterBody = Nothing, sortBody = Nothing, aggBody = Nothing, highlight = Nothing, trackSortScores = False, from = 0, size = 10}
472-- >>> pageSearch 10 100 search
474-- >>> pageSearch 10 100 search
473-- Search {queryBody = Just (QueryMatchQuery (MatchQuery {matchQueryField = FieldName "_all", matchQueryQueryString = QueryString "haskell", matchQueryOperator = Or, matchQueryZeroTerms = ZeroTermsNone, matchQueryCutoffFrequency = Nothing, matchQueryMatchType = Nothing, matchQueryAnalyzer = Nothing, matchQueryMaxExpansions = Nothing, matchQueryLenient = Nothing})), filterBody = Nothing, sortBody = Nothing, aggBody = Nothing, highlight = Nothing, trackSortScores = False, from = 10, size = 100}
475-- Search {queryBody = Just (QueryMatchQuery (MatchQuery {matchQueryField = FieldName "_all", matchQueryQueryString = QueryString "haskell", matchQueryOperator = Or, matchQueryZeroTerms = ZeroTermsNone, matchQueryCutoffFrequency = Nothing, matchQueryMatchType = Nothing, matchQueryAnalyzer = Nothing, matchQueryMaxExpansions = Nothing, matchQueryLenient = Nothing})), filterBody = Nothing, sortBody = Nothing, aggBody = Nothing, highlight = Nothing, trackSortScores = False, from = 10, size = 100}
474−pageSearch :: Int -> Int -> Search -> Search
476+pageSearch :: Int -- ^ The result offset
477+ -> Int -- ^ The number of results to return
478+ -> Search -- ^ The current seach
479+ -> Search -- ^ The paged search
475−pageSearch pageFrom pageSize search = search { from = pageFrom, size = pageSize }
480+pageSearch resultOffset pageSize search = search { from = resultOffset, size = pageSize }