[GH-ISSUE #489] Exact search for artist name possible? #289

Closed
opened 2026-02-27 23:21:49 +03:00 by kerem · 1 comment
Owner

Originally created by @Musikfreitag on GitHub (May 4, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/489

When I use "sp.search()", then I get results that contain the string anywhere in the hit result. Is it possible to do an exact search?

Example for the query "LEA"
results = sp.search(q='artist:' +'LEA', type='artist')
items = results['artists']['items']
for i in range(len(items)):
print(items[i]['name']+"\t"+str(items[i]['followers']['total']))

Current Results:
League of Legends 621187
Lea Salonga 118225
Christian Leave 178686
Yung Lean 418445
Leavv 13121
LeAnn Rimes 715975
The Human League 597907
Lea Michele 429499
Pure Prairie League 116541
Leah Maur 141

Expected Result:
LEA 446601

The current results are not sorted and the expected hit is not in the top 50 results, so adding "limit = 50" does not help. I am happy about any help for this issue, even it is a link to a part of the documentation that I missed.

Originally created by @Musikfreitag on GitHub (May 4, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/489 When I use "sp.search()", then I get results that contain the string anywhere in the hit result. Is it possible to do an exact search? **Example for the query "LEA"** results = sp.search(q='artist:' +'LEA', type='artist') items = results['artists']['items'] for i in range(len(items)): print(items[i]['name']+"\t"+str(items[i]['followers']['total'])) **Current Results:** League of Legends 621187 Lea Salonga 118225 Christian Leave 178686 Yung Lean 418445 Leavv 13121 LeAnn Rimes 715975 The Human League 597907 Lea Michele 429499 Pure Prairie League 116541 Leah Maur 141 **Expected Result:** LEA 446601 The current results are not sorted and the expected hit is not in the top 50 results, so adding "limit = 50" does not help. I am happy about any help for this issue, even it is a link to a part of the documentation that I missed.
kerem 2026-02-27 23:21:49 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@ritiek commented on GitHub (May 7, 2020):

Doesn't seem like Spotify offers making proper exact searches as of yet. Spotify includes a section on advanced search but none of them help with your example use-case:

https://developer.spotify.com/documentation/web-api/reference/search/search/
https://community.spotify.com/t5/Social/Is-there-a-n-extended-Spotify-search-syntax/td-p/1014655


The link https://support.spotify.com/us/using_spotify/features/search/ mentions:

Enter your search term in quotation marks “” to narrow results to exact matches, e.g. “Let’s Dance”.

But it doesn't seem to be working for your example artist search.

There has also been a support question asked on https://community.spotify.com/t5/iOS-iPhone-iPad/Search-need-an-quot-exact-match-quot/td-p/1116711 but doesn't have a satisfactory answer that works for your example use-case.

Hard luck I guess. :(

<!-- gh-comment-id:625464460 --> @ritiek commented on GitHub (May 7, 2020): Doesn't seem like Spotify offers making proper exact searches as of yet. Spotify includes a section on advanced search but none of them help with your example use-case: https://developer.spotify.com/documentation/web-api/reference/search/search/ https://community.spotify.com/t5/Social/Is-there-a-n-extended-Spotify-search-syntax/td-p/1014655 ----------- The link https://support.spotify.com/us/using_spotify/features/search/ mentions: > Enter your search term in quotation marks “” to narrow results to exact matches, e.g. “Let’s Dance”. But it doesn't seem to be working for your example artist search. There has also been a support question asked on https://community.spotify.com/t5/iOS-iPhone-iPad/Search-need-an-quot-exact-match-quot/td-p/1116711 but doesn't have a satisfactory answer that works for your example use-case. Hard luck I guess. :(
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#289
No description provided.