Skip to content

fix(spotify): use search.maxResults configuration for search limit#215

Open
realkalashnikov wants to merge 1 commit into
PerformanC:devfrom
realkalashnikov:fix/spotify-search
Open

fix(spotify): use search.maxResults configuration for search limit#215
realkalashnikov wants to merge 1 commit into
PerformanC:devfrom
realkalashnikov:fix/spotify-search

Conversation

@realkalashnikov

Copy link
Copy Markdown

Changes

  • Decoupled the Spotify search query limit parameter from the playlistLoadLimit configuration.
  • Refactored the search() method in src/sources/spotify.ts to retrieve and use this.nodelink.options.search.maxResults (defaulting to 10) instead of this.config.playlistLoadLimit.

Why

The official Spotify text search query API calls (/v1/search) were incorrectly inheriting the playlistLoadLimit configuration, which is designed solely to limit the amount of pages loaded when fetching Spotify Playlists, Albums, or Artists.

If a user configured a low playlistLoadLimit (e.g., 1 or 2 to avoid massive playlist ingestion and API rate limits), text-based Spotify searches (spsearch) would yield only 1 or 2 results instead of the expected search result list count.

Standardizing on search.maxResults fixes this text search limitation bug and aligns the Spotify source's text search behavior with all other sources (such as Apple Music, Tidal, and Deezer) in NodeLink.

Checkmarks

  • The modified endpoints have been tested.
  • Used the same indentation as the rest of the project.
  • Still compatible with LavaLink clients.

Additional information

This bug caused Discord music bots using NodeLink to always return only a single track choice when users searched by keyword using the Spotify source, if playlist loading restrictions were active.

Copilot AI review requested due to automatic review settings July 1, 2026 05:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Spotify text search result limiting by decoupling it from playlistLoadLimit and instead using the global search.maxResults option, aligning Spotify search behavior with other NodeLink sources.

Changes:

  • Refactored SpotifySource.search() to use this.nodelink.options.search.maxResults (defaulting to 10) for search result limits.
  • Removed the prior coupling to this.config.playlistLoadLimit for Spotify search requests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/sources/spotify.ts
if (limit > 999) {
limit = 10
}
let limit = this.nodelink.options.search.maxResults || 10
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.

2 participants