Skip to content

fix: corrected the pagination counts for vendor search#4043

Open
devlopharsh wants to merge 1 commit intoeclipse-sw360:mainfrom
devlopharsh:fix/vendor-search-pagination-count
Open

fix: corrected the pagination counts for vendor search#4043
devlopharsh wants to merge 1 commit intoeclipse-sw360:mainfrom
devlopharsh:fix/vendor-search-pagination-count

Conversation

@devlopharsh
Copy link
Copy Markdown
Contributor

Fixes: #4039

Issue: #4039

Summary

The problem was that filtered vendor results were returned correctly, but
PaginationData.totalRowCount was derived from the full CouchDB view size
instead of the filtered subset. As a result, the API could return a single
matching vendor while still reporting larger totalElements and totalPages,
which also produced incorrect next and last pagination links.

Changes Made

  • Update shared pagination count handling in
    libraries/datahandler/.../DatabaseRepositoryCloudantClient.java
  • Detect filtered view queries (key, keys, startKey, endKey)
  • Compute totalRowCount from the filtered query result instead of using the
    full view totalRows
  • Add regression assertions in
    backend/vendors/.../VendorHandlerTest.java to verify filtered search counts

Suggest Reviewer

@deo002

How To Test?

  1. Run the existing REST-side vendor tests:
    • mvn -q test -pl rest/resource-server '-Dtest=VendorTest' '-Dbase.deploy.dir=.'
    • mvn -q test -pl rest/resource-server '-Dtest=VendorSpecTest' '-Dbase.deploy.dir=.'
  2. manual verification against a running server by the command GET /resource/api/vendors?page=0&page_entries=10&searchText=<matching-text>

Checklist

Must:

  • All related issues are referenced in commit messages and in PR
  • No new dependencies were added
  • Relevant tests were run locally where environment allowed
  • If code is AI-generated, mention the tool and model used

Signed-off-by: developharsh <harsh237hk@gmail.com>
@devlopharsh
Copy link
Copy Markdown
Contributor Author

@deo002 , Hello sir ,
please have a review over the PR and acknowledge me for any further changes needed , thank you .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong Pagination Info in Vendors Endpoint

1 participant