Enhance tender search functionality with pagination and filtering improvements
continuous-integration/drone/push Build is passing

- Updated the tender search handler to include a new `include_total` query parameter, allowing clients to request total count and pagination metadata for search results.
- Refactored the `tenderSearchListProjection` to exclude heavy fields from the list response, optimizing data retrieval.
- Modified the `buildSearchFilter` method to utilize the `processing_metadata.documents_scraped` flag for filtering, improving search accuracy.
- Added unit tests for the new pagination features and search filter logic, ensuring robust validation of the search functionality.

This update significantly enhances the tender search experience by providing more flexible pagination options and improving the efficiency of data handling.
This commit is contained in:
Mazyar
2026-07-10 16:23:46 +03:30
parent 2fbf329182
commit 843e1508df
7 changed files with 82 additions and 29 deletions
+16 -1
View File
@@ -18,11 +18,26 @@ func TestNewPaginationDefaults(t *testing.T) {
if err != nil {
t.Fatalf("NewPagination: %v", err)
}
if p.Limit != 10 || p.Offset != 0 || p.Cursor != "" {
if p.Limit != 10 || p.Offset != 0 || p.Cursor != "" || p.IncludeTotal {
t.Fatalf("unexpected pagination: %+v", p)
}
}
func TestNewPaginationIncludeTotal(t *testing.T) {
e := echo.New()
req := httptest.NewRequest(http.MethodGet, "/?include_total=true", nil)
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)
p, err := NewPagination(c)
if err != nil {
t.Fatalf("NewPagination: %v", err)
}
if !p.IncludeTotal {
t.Fatal("expected include_total=true")
}
}
func TestNewPaginationCursorConflict(t *testing.T) {
e := echo.New()
req := httptest.NewRequest(http.MethodGet, "/?limit=10&offset=5&cursor=abc", nil)