From bdf0d8e85268db1e74d3eb5967d0ac2d9b044d3f Mon Sep 17 00:00:00 2001 From: Karanjot Singh Date: Fri, 13 Sep 2024 01:51:20 +0530 Subject: [PATCH] Set default value for page size in Fluent and IndexSearch Signed-off-by: Karanjot Singh --- atlan/assets/fluent_search.go | 5 +++++ atlan/assets/index_search_client.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/atlan/assets/fluent_search.go b/atlan/assets/fluent_search.go index 995e9a1..d17113c 100644 --- a/atlan/assets/fluent_search.go +++ b/atlan/assets/fluent_search.go @@ -139,6 +139,11 @@ func (fs *FluentSearch) IncludeOnRelations(fields ...string) *FluentSearch { // Execute performs the search and returns the results. func (fs *FluentSearch) Execute() ([]*model.IndexSearchResponse, error) { + + if fs.PageSize == 0 { + fs.PageSize = 300 // Set Default Page Size + } + pageSize := fs.PageSize request := fs.ToRequest() diff --git a/atlan/assets/index_search_client.go b/atlan/assets/index_search_client.go index b201f4b..d547bbc 100644 --- a/atlan/assets/index_search_client.go +++ b/atlan/assets/index_search_client.go @@ -252,6 +252,9 @@ func (it *IndexSearchIterator) IteratePages() ([]*model.IndexSearchResponse, err return nil, fmt.Errorf("no more results available") } + if it.pageSize == 0 { + it.pageSize = 300 // Set Default Page Size + } // Perform an initial search to get the approximateCount it.request.Dsl.From = 0 it.request.Dsl.Size = it.pageSize