Skip to content

Conversation

@d-teller
Copy link
Contributor

@d-teller d-teller commented Sep 4, 2025

…on errors (#4)

Replace all placeholder data implementations in search service methods with proper error messages that inform users about Atlas Admin API limitations.

Changes Made:

  • Modified GetSearchAnalyzers() to return error instead of placeholder data
  • Modified GetSearchFacets() to return error instead of placeholder data
  • Removed helper functions that contained placeholder implementations:
    • extractAnalyzersFromDefinition()
    • extractFacetsFromDefinition()
    • analyzeIndexDefinition()
  • Updated error messages to guide users to Atlas UI for unsupported features

Affected Methods:

  • GetSearchAnalyzers: Returns error about SDK not exposing analyzer details
  • GetSearchFacets: Returns error about SDK not exposing facet details
  • GetSearchMetrics: Already properly returns limitation error (unchanged)
  • AnalyzeSearchIndex: Already properly returns limitation error (unchanged)
  • ValidateSearchQuery: Already properly returns limitation error (unchanged)

Error Message Pattern:
All errors now follow consistent format:

  1. Structured logging with context (project_id, cluster_name, reason)
  2. Clear error message explaining the Atlas SDK limitation
  3. Guidance to use Atlas UI for the specific functionality

Files Modified:

  • internal/services/atlas/search.go: Core service method changes (-84 lines)
  • cmd/atlas/search/search.go: Minor comment updates
  • internal/output/advanced_search.go: Retained placeholder handling for compatibility

Backward Compatibility: Yes - methods still exist but now return informative errors

This change prevents users from receiving misleading placeholder data and provides clear guidance on how to access these features through the Atlas UI.

Refs: Atlas SDK limitation handling

d-teller and others added 2 commits September 4, 2025 09:32
…on errors (#4)

Replace all placeholder data implementations in search service methods with
proper error messages that inform users about Atlas Admin API limitations.

**Changes Made:**
- Modified `GetSearchAnalyzers()` to return error instead of placeholder data
- Modified `GetSearchFacets()` to return error instead of placeholder data
- Removed helper functions that contained placeholder implementations:
  - `extractAnalyzersFromDefinition()`
  - `extractFacetsFromDefinition()`
  - `analyzeIndexDefinition()`
- Updated error messages to guide users to Atlas UI for unsupported features

**Affected Methods:**
- `GetSearchAnalyzers`: Returns error about SDK not exposing analyzer details
- `GetSearchFacets`: Returns error about SDK not exposing facet details
- `GetSearchMetrics`: Already properly returns limitation error (unchanged)
- `AnalyzeSearchIndex`: Already properly returns limitation error (unchanged)
- `ValidateSearchQuery`: Already properly returns limitation error (unchanged)

**Error Message Pattern:**
All errors now follow consistent format:
1. Structured logging with context (project_id, cluster_name, reason)
2. Clear error message explaining the Atlas SDK limitation
3. Guidance to use Atlas UI for the specific functionality

**Files Modified:**
- `internal/services/atlas/search.go`: Core service method changes (-84 lines)
- `cmd/atlas/search/search.go`: Minor comment updates
- `internal/output/advanced_search.go`: Retained placeholder handling for compatibility

**Backward Compatibility:** Yes - methods still exist but now return informative errors

This change prevents users from receiving misleading placeholder data and
provides clear guidance on how to access these features through the Atlas UI.

Refs: Atlas SDK limitation handling

Co-authored-by: Danny Teller <danny.teller@tipalti.com>
@d-teller d-teller merged commit 864163d into main Sep 4, 2025
17 checks passed
@github-actions
Copy link

github-actions bot commented Sep 4, 2025

🎉 This PR is included in version 3.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants