Skip to content

ATLAS-5424: Expose exact vs approximate basic search count (API + UI) - #773

Open
saksenasonali wants to merge 6 commits into
apache:masterfrom
saksenasonali:ATLAS-5424
Open

saksenasonali wants to merge 6 commits into
apache:masterfrom
saksenasonali:ATLAS-5424

Conversation

@saksenasonali

@saksenasonali saksenasonali commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

ATLAS-5424: Expose exact vs approximate basic search count in API and UI

What changes were proposed in this pull request?

Basic search can return Solr-backed approximate total counts. Some queries (type-only / index-only) can treat the count as exact; others (in-memory filters such as startsWith, neq) cannot. This PR adds approximateCountExact on AtlasSearchResult, sets it in discovery/search processing, and surfaces it in React UI and Classic UI pagination text (~ prefix/suffix when the count is not exact).

Solution / fix

Backend

  • AtlasSearchResult (+ Python model): new approximateCountExact field.
  • EntitySearchProcessor / EntityDiscoveryService: set flag when the count is index-only vs when in-memory filters apply.
  • Unit tests: EntitySearchProcessorTest, AtlasDiscoveryServiceTest, TestAtlasSearchResult.

React UI (dashboard/)

  • SearchResult reads approximateCountExact from basic search API responses.
  • TableLayout / TablePagination: server-side pagination shows ~ around total when approximateCountExact is false.
  • Tests: TablePagination.test.tsx (single Router via renderServerSidePagination + { withRouter: false }), SearchResult.test.tsx (passes approximateCountExact cases).

Classic UI (dashboardv2/)

  • SearchResultLayoutView.js: formatBasicSearchPageRecordText honors approximateCountExact (Classic parity with React).

Testing summary

Manual

Step Expected
Atlas on http://localhost:21000 (Docker or local) Version API responds
Search → Basic, type only (e.g. hive_db) Pagination / API: count without ~ when exact
Search → Basic with in-memory filter (e.g. hive_column + qualifiedName starts with default) ~ on approximate total; API omits or does not set approximateCountExact=true
Compare React UI vs Classic UI on same search Same approximate vs exact pagination behavior

Automation (local)

mvn install -pl intg -DskipTests
mvn -pl repository -Dtest=EntitySearchProcessorTest#approximateCountExactForIndexOnlyTypeSearch,EntitySearchProcessorTest#approximateCountNotExactForInMemoryNeqFilter,EntitySearchProcessorTest#approximateCountNotExactForStartsWithFilter test -DfailIfNoTests=false
mvn -pl repository -Dtest=AtlasDiscoveryServiceTest#basicSearchSetsApproximateCountExactForIndexOnlyQuery,AtlasDiscoveryServiceTest#basicSearchOmitsExactCountWhenInMemoryFilterApplied test -DfailIfNoTests=false
mvn -pl intg -Dtest=TestAtlasSearchResult test -DfailIfNoTests=false

cd dashboard
export NPM_CONFIG_ENGINE_STRICT=false
npm ci --no-audit --no-fund
./node_modules/.bin/jest src/components/Table/__tests__/TablePagination.test.tsx --watchAll=false --runInBand --forceExit
./node_modules/.bin/jest src/views/SearchResult/__tests__/SearchResult.test.tsx -t "passes approximateCountExact" --watchAll=false --runInBand --forceExit

bash dev-support/scripts/e2e-basic-search-count.sh
Test area Result
EntitySearchProcessorTest (3 approximate-count tests) Pass
AtlasDiscoveryServiceTest (2 basic-search tests) Pass
TestAtlasSearchResult Pass
TablePagination.test.tsx 11/11 pass
SearchResult.test.tsx (approximateCountExact) 2/2 pass
e2e-basic-search-count.sh (local :21000) Pass — hive_db → approximateCountExact=true; filtered hive_column → flag not true

Code coverage (dashboard/)

From npm run test:ci:

Metric Coverage
Statements 88.82%
Branches 82.27%
Functions 80.19%
Lines 88.82%
Test results 4937 passed, 197 suites (1 unrelated failure in PropagationPropertyModal.test.tsx on local run — not part of this change)

Changed / feature-related files:

File Statements Branches Functions Lines
TablePagination.tsx 78.31% 66.95% 78.57% 78.31%
TableLayout.tsx 91.05% 68.26% 50% 91.05%
SearchResult.tsx 86.72% 78.34% 94.59% 86.72%

Report: dashboard/coverage/lcov-report/index.html


Linter status

cd dashboard && npm run lint
Check Status
ESLint errors 0 (passes --max-warnings 200)
Warnings 163 (pre-existing)

Build status (local)

Build Command Status
React UI npm run typecheck Pass
React UI npm run build (Vite) Pass
React UI (Maven) mvn -pl dashboard -am package -DskipTests Pass
Classic UI (Maven) mvn -pl dashboardv2 -am package -DskipTests Pass
Backend modules mvn -pl intg,repository -am package -DskipTests Pass
Full reactor mvn -DskipTests package (root) Failed at atlas-distro (A zip file cannot include itself — local packaging quirk, not introduced by this PR)

How was this patch tested?

Automated: Java and dashboard tests above; npm run test:ci for dashboard-wide coverage.

Manual: Basic search type-only vs filtered; React vs Classic pagination; live curl script against Atlas on port 21000.
Screenshot 2026-09-29 at 6 20 05 PM


Screenshot 2026-09-29 at 6 19 51 PM

ssaksena-lang and others added 6 commits September 27, 2026 03:18
Keep upstream Docker webapp expansion and startup checks; retain PostgreSQL
JDBC libext support and search pagination approximate-count UI with audit footer.

Co-authored-by: Cursor <cursoragent@cursor.com>
The server tarball does not include the PostgreSQL driver; install it into
libext at image build time when ATLAS_BACKEND=postgres and drop runtime copy
from atlas.sh. Document the requirement in the docker README.

Co-authored-by: Cursor <cursoragent@cursor.com>
The postgres JDBC and e2e script changes were local validation scaffolding
unrelated to approximateCountExact; revert dev-support to master so this PR
only carries the API, model and UI change.

Co-authored-by: Cursor <cursoragent@cursor.com>
Mirror approximateCountExact in dashboardv2 basic search pagination text;
add TablePagination and SearchResult unit tests for exact vs approximate footer.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use MemoryRouter with withRouter: false in test-utils to avoid nested routers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@saksenasonali saksenasonali changed the title ATLAS-5424: CDPD-40161 — Expose exact vs approximate basic search count (API + UI) ATLAS-5424: Expose exact vs approximate basic search count (API + UI) Sep 26, 2026
Comment thread dev-support/atlas-docker/scripts/atlas.sh Outdated
Comment thread dev-support/atlas-docker/Dockerfile.atlas Outdated

@pawarprasad123 pawarprasad123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Classic UI not updated
dashboardv2 still shows counts without the exact/approximate distinction. Users on Classic UI get no benefit from this PR.

Comment thread dashboard/src/components/Table/TablePagination.tsx Outdated
Comment thread dashboard/src/components/Table/TableLayout.tsx
Comment thread dev-support/scripts/e2e-basic-search-count.sh Outdated
Comment thread dashboard/src/components/Table/TableLayout.tsx
Comment thread dev-support/atlas-docker/Dockerfile.atlas
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.

4 participants