fix(spotify): use search.maxResults configuration for search limit#215
Open
realkalashnikov wants to merge 1 commit into
Open
fix(spotify): use search.maxResults configuration for search limit#215realkalashnikov wants to merge 1 commit into
realkalashnikov wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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 usethis.nodelink.options.search.maxResults(defaulting to 10) for search result limits. - Removed the prior coupling to
this.config.playlistLoadLimitfor Spotify search requests.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (limit > 999) { | ||
| limit = 10 | ||
| } | ||
| let limit = this.nodelink.options.search.maxResults || 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
playlistLoadLimitconfiguration.search()method insrc/sources/spotify.tsto retrieve and usethis.nodelink.options.search.maxResults(defaulting to 10) instead ofthis.config.playlistLoadLimit.Why
The official Spotify text search query API calls (
/v1/search) were incorrectly inheriting theplaylistLoadLimitconfiguration, 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.,1or2to 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.maxResultsfixes 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
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.