Skip to content

Commit

Permalink
Merge pull request #58 from atlanhq/DVX-613-Default-Value-for-Page-Size
Browse files Browse the repository at this point in the history
DVX: 613 - Feat: Set default value for page size in FluentSearch and IndexSearch
  • Loading branch information
0xquark authored Sep 12, 2024
2 parents 5fa6b7a + bdf0d8e commit 5f22cb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions atlan/assets/fluent_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 3 additions & 0 deletions atlan/assets/index_search_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f22cb8

Please sign in to comment.