For the category_playlists function in Spotipy API, which categories show up when using the country parameter? - spotipy

I'm assuming that using the country parameter in category_playlists(category_id=None, country=None, limit=20, offset=0) returns the top n (limit) number of playlists in that category for a certain country. Is that true? Or are the playlists ordered in some way other than popularity?

The order in which the playlists are returned is the same as what you can see in the Browse section in the Spotify client, and it is not necessarily ordered by popularity. Here's an example for the "Pop" category and Italy as country:
for i in spotify.category_playlists("pop",country="IT")['playlists']['items']:
print(i['name'])
This command returns:
Big Italiani
Hot Hits Italia
Alta Rotazione
Generazione Z
Hit Internazionali
Today's Top Hits
Hit Italiane
New Music Friday Italia
which corresponds to what you can see on the client (note the amount of followers is not in a descending order):

Related

Display all the distinct values in 1 ssrs letter

Hi I am creating an ssrs report (which is a letter format). And in the letter format, if a owner has highest sales for 3 products in same store I need those products to be listed in the same letter instead of 3 different letters. I have written an expression for the body of the letter. But that expression is taking all the products that has highest sales and generating 3 different letters. May I know how can I embed the product names within the body of the letter?
Sample That I need:
Hi Doc,
It has really great that you are making a huge impact on our product sales.
In our recent survey, we found that your store had the highest sales for following products:
Comforters
Cosmetics
Toys
Please continue this xyz.
NA Dept.

STRAPI REST API Endpoint to get items with certain values in two relations

I struggle to get strapi rest api to return a restaurant that has certain values in two realations. The documentation does not tell me the answer.
My structure:
Restaurants has two relations and some data fields:
Name (data)
Image (data)
City (relation)
Foodtype (relation)
City has mutliple values
Berlin (id:1)
London (id:2)
Foodtype has multiple values
French (id:1)
Chinese (id:2)
I would like to create an API call that populates me all All images of Restaurants in Berlin with French food
I managed to populate All images of Restaurants in Berlin (so London is filtered out) but I would also like to reduce it to the restaurants with French food I used this GET call so far http://localhost:1337/api/cities/1?populate=restaurants.image
cities/1 reduces it to the City relation by ID. Can anybody advise me how I extend the API call to reduce it further to the foodtype relation for ID 1?

What's the most effective way of storing this data?

Need help figuring out a good way to store data effectively and efficiently
I'm using Parse (JavaScript SDK), here's an example of what I'm trying to store
Predictions of football (soccer) matches so an example of one match would be;
Team A v Team B
EventID = "abc"
Categories = ["League-1","Sunday-League"]
User123 predicts the score will be Team A 2-0 Team B -> so 2-0
User456 predicts the score will be Team A 1-3 Team B -> so 1-3
Each event has information attached to it like an eventId, several categories, start time, end time, a result and more
I need to record a score prediction per user for each event (usually 10 events at a time so a lot of predictions will be coming in)
I need to store these so I can cross reference the correct result against the user's prediction and award points based on their prediction, the teams in the match and the categories of the event but instead of adding to a total I need all the awarded points stored separately per category and per user so I can then filter based on predictions between set dates and certain categories e.g.
Team A v Team B
EventID = "abc"
Categories = ["League-1","Sunday-League"]
User123 prediction = 2-0
Actual result = 2-0
So now I need to award X points to User123 for Team A, Team B, "League-1", and "Sunday-League" and record it to the event date too.
I would suggest you create a table for games and a table for users and then an associative table to handle the many to many relationship. This is a pretty standard many to many relationship.

SOLR search array vs individual documents

I've got a business case where I need to check if the search query is about displays businesses
eg: q="night clubs new york"
I've got a list of Countries, state city and region in my database 3million + records and I've got a list of business categories.
All I want to do is check if in the query has a business category in it (night clubs) and does it have a City, state or country's name (new york). So i'm checking the number of results retuned for the below query. If I get 2 numResults then this is a business query and then I query my Solr index to search for businesses.
query: places_ss:(night clubs new york) OR categories_ss:(night clubs new york)
Speed Question: How should I save the list of cities, states and countries in SOLR to get maximum search speed ?
Have one document id:places and add distinct cities, states and countries in on array places_ss
have multiple documents with different id's with 100,000 place names in each document in an array.
?
have a document or multiple documents with place_s string(not array) each place separated by space and each space in place separated by underscore eg: new york becomes new_york.
And during query time I will get multiple combinations of night clubs new york
eg: night night_clubs night_clubs_new night_clubs_new_york clubs_new clubs_new_york new_york york and query for place.
Would it be a good idea to have a separate core just for above place documents to increase speed ?
Is this a good solution ?
Document organisation :
better to have a document approche with :
- location
- activity
- other things needed!
location
You should save your location like this
Country:state:city:suburb.... so that you can seach in usa:new york:new york*
of ::new york
No need for _
avoid that, there is no needs !
activity
activity should be stored in another field for precision on the search and speed.

Grouping results and keeping facet counts consistent

Using Solr 3.3
Key Store Item Name Description Category Price
=========================================================================
1 Store Name Xbox 360 Nice game machine Electronic Games 199.99
2 Store Name Xbox 360 Nice game machine Electronic Games 199.99
3 Store Name Xbox 360 Nice game machine Electronic Games 249.99
I have data similar to above table and loaded into Solr. Item Name,
description Category, Price are searchable.
Expected result
Facet Field
Category
Electronic(1)
Games(1)
**Store Name**
XBox 360 Nice game machine priced from 199.99 - 249.99
What will be the query parameters that I can send to Solr to receive results above, basically I wan to group it by Store, ItemName, Description and min max price
And I want to keep paging consistent with the main (StoreName). The paging should be based on the Store Name group. So if 20 stores were found. I should be able to correctly page.
Please suggest
If using Solr 4.0, the new "Grouping" (which replaces FieldCollapsing) fixes this issue when you add the parameter "group.facet=true".
So to group your fields you would have add the following parameters to your search request:
group=true // Enables grouping
group.facet=true // Facet counts to be number of groups instead of documents
group.field=Store // Groups results by the field "Store"
group.ngroups=true // Tells Solr to return the number of groups found
The number of groups found is what you would show to the user and use for paging, instead of the normal total count, which would be the total number of documents in the index.
Have you looked into field collapsing? It is new in Solr 3.3.
http://wiki.apache.org/solr/FieldCollapsing
What I did is I created another field that grouped the required fields in a single field and stored it, problem solved, so now I just group only on that field and I get the correct count.

Resources