Skip to content

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

Merged
ToddyTheNoobDud merged 2 commits into
PerformanC:devfrom
realkalashnikov:fix/spotify-search
Jul 4, 2026
Merged

fix(spotify): use search.maxResults configuration for search limit#215
ToddyTheNoobDud merged 2 commits 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 Outdated
if (limit > 999) {
limit = 10
}
let limit = this.nodelink.options.search.maxResults || 10
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

All Contributors have signed the CLA. The PR is now allowed to be merged.
Posted by the CLA Assistant Lite bot.

@ToddyTheNoobDud

Copy link
Copy Markdown
Member

I have read the CLA Document and I hereby sign the CLA

performanc-bot added a commit to PerformanC/CLA-Signatures that referenced this pull request Jul 4, 2026
@ToddyTheNoobDud ToddyTheNoobDud merged commit 8b432dd into PerformanC:dev Jul 4, 2026
1 of 2 checks passed
@ToddyTheNoobDud

Copy link
Copy Markdown
Member

Thanks for your contribution ! :)

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants