Foursquare venue photo order - foursquare

I am doing a Foursquare query on venues and I need to get a list of photos. I noticed that the photos in the array are ordered by the "createdAt" key. Is there any part of the API that would return the photos in the order they are ranked in Foursquare, or at least get the top ranked photo?

Yup, a venues/photos call returns results in the order that they're ranked on Foursquare in order of "best."

Related

Getstream- How to get a trending hashtags?

If the hashtag for 10 activities has python and 15 activities for techie,then need a trending hashtag how do i filter that?
trending hashtag 1:techie and hashtag 2:python
how do you want to display this? Something showing the most hashtags first, then next highest, etc? I would think an aggregated feed that follows all your hashtag feeds would work here, and you aggregate on the hashtag. Then you'll need to sort on your own before displaying, as we don't allow ranking on aggregated feeds.
If that's not what you're trying to do please elaborate. Thanks!

Viewing all Products that a Customer has purchased on Stripe

How can I view all Products that a Customer has purchased using the Stripe API? Is there a specific event that is sent out when a purchase occurs? I'm seeing that there is an Orders item as well, but am not sure that Products can only be purchased as part of Orders.
Sample query for getting all Orders by a Customer:
from stripe import Order
Order.list(customer=customer_1['data'][0].id)
Basically I want to get all non-subscription-based items that the user has purchased -- will querying the API for Orders this way give me all non-subscription-based items, since a Product must necessarily each be tied to an Order, or is there a different/better way of doing this?
You can retrieve all orders for a customer with the list all orders method and the customer parameter.
You can then go through the order's items attribute to find the SKUs included in the order.
Finally, you can use a SKU's product attribute to retrieve the product associated to the SKU.
In Python, you could do something like this:
customer_id = "cus_..."
products = [] # list of products ordered at least once by the customer
orders = stripe.Order.list(customer=customer_id)
for order in orders.auto_paging_iter():
for item in order.items.auto_paging_iter():
if item.type == "sku":
sku = stripe.SKU.retrieve(item.parent)
if sku.product not in products:
products.append(product)
The above code is not very efficient as it would send a SKU retrieve request for every item of type "sku". In practice, you'd likely want to cache the results and only retrieve each SKU once.

Foursquare API: suggestcompletion near specified city

My aim is to find venues in specific city.
For this purpose i am using /v2/venues/suggestcompletion endpoint. So for example next request https://api.foursquare.com/v2/venues/suggestcompletion/?limit=10&query=McDonald&near=Napa,%20CA,%20United%20States&client_id=xxx&client_secret=yyy&v=20161118&locale=en returns venues not only in Napa, but also in Fairfield, Vallejo etc. Result for this query.
Ok, as far as I know what city I need I can filter result by city on my side. But in this approach I received next problem. Next query https://api.foursquare.com/v2/venues/suggestcompletion/?limit=10&query=Diviera%20Drive&near=New%20York,%20NY,%20United%20States&client_id=xxx&client_secret=yyy&v=20161118&locale=en returns venue in city labeled Brooklyn. Result for this Obviously New York string and Brooklyn does not match. Maybe somehow I can retrieve main city (New York) next to borough (Brooklyn) so I can filter it on my side properly
So my question is: how can I receives venues only in specified city.
The near parameter you're using is not a filter - it's a coarse geocoder that's used to generate a latitude/longitude to search near.
The search documentation does not show a way to limit results to a city name. If you only want to show results in a certain city you'd have to do that filtering yourself. Since the city name may be missing or incorrect (sometimes city boundaries are fuzzy) a more precise way could be filter based on the lat/lng coordinate.

Azure Search min max values

I have an index that is populated with Products. Each product has price field. I want to implement facet navigation on categories pages and i want my users to be able to search for products within a price range. At the same time, I want them to know what the minimum and maximum product price is across products in selected category. As i know Azure Search does not support min/max values in responses. So i am looking for some work around. I think that i can mark my price field as facetable and get min and max value from facet result, but default facet results count is 10, and if i understand correctly to get all prices from facet result i need to set count to Int.Max or something. That does not sound nice.
So what is the best solution to get min and max product price in specific category?
More direct approach to get the min and max product prices would be using $filter, $orderBy and $top in a Search request.
For example,
https://[service name].search.windows.net/indexes/products/docs?search=*&$filter=productName eq 'Toys'&$orderBy=price asc&$top=1.
You will need to parse the price in the response.
The approach using facet would be more expensive and, as you said, can only get you an approximation because boundaries of each facet is from pre-configured range.
Nate

Solr: Apply faceting when query contains particular terms

I have a database of product information indexed by name, type, manufacturer, etc. Users often submit search queries whose results would be contained neatly in one or more facets. When this situation arises, I would like for Solr to parse the query and apply the relevant facets.
For example, searching shoes should return results in the shoe category. More ambitiously, searching plaid shirt should query plaid on items in the shirt category.
Is it possible to configure Solr to do this?
Thanks in advance.
Asking Solr to do what you want is a tall order. Your best bet would be to store categories in a field that is weighted very highly. For example, if you have a category field with the value of "shoes", having a hit on that field will increase the relevance of documents on that category, thus having them show up first. Same goes for the second example.
As for faceting, your question is not clear on how you want to apply faceting.

Resources