Amazon Api Item Search - amazon

I am using Amazon Api to search for item. I am doing a simple
amazon.ItemSearch(Keywords="Sachin Tendulkar", SearchIndex="All", ResponseGroup="ItemAttributes")
But the result is not a popular Sachin Tendulkar book or the best search I would want.
How can I get multiple results in Item Search ?
How can I get the most popular search result?
amazon.ItemSearch(Keywords="UC Berkeley", SearchIndex="All", ResponseGroup="ItemAttributes")
gives even worse results.
Is there an option in the API that I am missing? Thanks

If you're not getting the results you expect, adjusting the SearchIndex option to something other than "All" can often help improve the results by making a less broad search.
If you change it to "Books", do you get the expected results for "Sachin Tendulkar"?
In case that doesn't fix the problem, do you get expected results for really common searches like "Apple TV"? And when you search for "Sachin Tendulkar" or others on Amazon.com do you the items returned by your API request show up at all (perhaps even pages down)?

Related

How to use nominatim.openstreetmap.org/search to limit results at radius of 1km?

When using https://nominatim.openstreetmap.org/search?format=xml&q=bahamas%20ponte%20nova&addressdetails=1&limit=3
I have exactly the result that I want.
But if you delete the name of my city "Ponte Nova", in the result comes up to references from Spain, but no results come from my city.
How do I get the results to focus on a given radius?
Please see see Nominatim API documentation.
According to section Result Limitation you can use viewbox=<x1>,<y1>,<x2>,<y2> and bounded=1 to restrict the search results to a specific area.
Example: https://nominatim.openstreetmap.org/search?format=xml&q=bahamas&addressdetails=1&limit=3&viewbox=-43.00804%2C-20.36925%2C-42.73699%2C-20.44969&bounded=1

How to Get Autocomplete with Several Words

I'm using autocomplete on a field in Azure Search... it works great, however I want the autocomplete results to return the next "x" number of words (like in the following screenshot https://learn.microsoft.com/en-us/azure/search/index-add-suggesters)
I've tried all three Autocomplete types "oneTerm", "twoTerms" and "oneTermWithContext" however none of those give me the expected results.
I expect to type "tom clan" and autocomplete should return "tom clancys rainbow six siege"
Excellent point about the documentation showing several words in the example and the autocomplete API only supporting up to two terms ahead. I think we should update the example to better reflect the actual behavior of the API.
If you are interested, please create a feedback item for the API enhancement you suggested so it can collect some votes: https://feedback.azure.com/forums/263029-azure-search
Thanks!
Mike Carter
Azure Search product team

Outlook REST API: How to page through $search results, when searching for messages

I have troubles paging through message search results with the rest API.
I have a request looking like this:
outlook.office.com/api/v2.0/me/messages/?$search="deni"
the request returns a proper result and also includes a 'next page' looking like this:
"#odata.nextLink": "https://outlook.office.com/api/v2.0/me/messages/?%24search=%22deni%22&%24top=10&%24skiptoken=aT01NjMzYWQ3OS02MmJjLTQ5ZDEtODg4ZC0zYTgwNDlhOTY3Nzkmcz0xMA%3d%3d"
I guess this link is URL encoded so I URL decode it to get this:
outlook.office.com/api/v2.0/me/messages/?$search="deni"&$top=10&$skiptoken=aT01NjMzYWQ3OS02MmJjLTQ5ZDEtODg4ZC0zYTgwNDlhOTY3Nzkmcz0xMA==
However, when i try to make request with the next link I'm getting 405 Method Not Allowed with the following error:
"The OData request is not supported."
I've tried it in the sandbox as well (oauthplay.azurewebsites.net) - same result. What could it be that I am doing wrong. What is the right way to page through the search results?
I know that there is a limit of 250 messages that could be searched, but this is not the case here. I have 10 and I am trying to read the next 10.
Of course I have tried paging with the $skip and $top parameters, but $kip is not supported together with $search.
I can't seem to find a definitive answer in the documentation on how to page through search results and is it possible at all.
Thanks to anyone willing to help.

Youtube search using the google API

I am using the google API and I wanted to do a youtube search.
I request a search with https://www.googleapis.com/youtube/v3/search?part=snippet&q=[word that I searched for]&key=my_keyto get the items array. I noticed though that the items array does not return the results in the same order as when you search youtube yourself.
Ex: if I search for the word 'bad' the first result in the items array is the "Young Lex ft AwKarin - BAD ( Official Music Video Clip )" while if I searched like a youtube user its the "Michael Jackson - Bad (Shortened Version)".
Perhaps they are not ordered and I have to order them using a property or something I have missed.
So my question is how can I make the items array return as the first item the first result that would have appeared in the youtube search.
edit: I have tried adding chart=MostPopular leaving to default videoCategoryId, but it still showed the same first result.
Well, it seems that the YouTube acts like that and it is a natural behavior of it. The only possible way that you can do to match the API and the YouTube site itself is by passing the same filter for it. Example is upload date and viewCount.
Here is the example request for viewCount.
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&maxResults=10&order=viewCount&q=spider&_h=1&
and this is for the YouTube site
https://www.youtube.com/results?q=spider&sp=CAM%253D
Hope this slight information helps you.

Pagination in Marklogic while using Search API

I have around 53,00,000 documents in MarkLogic server and I am building a simple search application. User enters a search term and MarkLogic server searches that term in all the nodes in all the documents and returns the matching documents as the result. I have implemented a custom paging to show results per page. I am showing 10 results per page.
I am using search api for this as:-
import module namespace search="http://marklogic.com/appservices/search" at "/Marklogic/appservices/search/search.xqy";
declare variable $options:=
<options xmlns="http://marklogic.com/appservices/search">
<transform-results apply="raw"/>
</options>;
search:search($p, $options, $noRecFrom, 10)/search:result
where $p is the input from the user $noRecFrom is the number which indicates from where we have to show records. For example for page 1 $noRecFrom will be 1, for page 2 $noRecFrom will be 11, for page 3 $noRecFrom will be 21 and so on. For paging there are hyperlinks to go to First, Next, Prev and Last pages.
To calculate the total number of records returned I am using:-
for $x in search:search($p, $options)
return $x//#total;
While First, Next and Prev hyperlink works perfectly but if someone clicks Last the application stops responding and the query does not show any output. Is it due to the large number of documents in the database or I am implementing it wrongly.
Is there any efficient way for pagination in MarkLogic (for search:search) so that the user can go the Last page without delay in query result for such a large database ?
The way you've implemented it, you're running the search repeatedly in your for loop. And that would indeed be slow.
Instead, you should be calculating a $start parameter based on the #total and number of documents per page, and passing that in as an argument (I think it's the third one) to search:search.
I would also recommend making sure you can run in unfiltered mode. There is good information about optimizing for fast pagination (indexes, etc) on the developer site; the idea is to resolve queries out of indexes to give very good, accurate unfiltered performance.
If you do it that
There is a tutorial on paginated search at http://developer.marklogic.com/learn/2006-09-paginated-search
Once you have resolved the issues mentioned by cwhit above, if you still want to get to the last page of data in a faster manner, you could make your code smart enough to reverse the sort order and pull the correct offset of records.
Here's another tip:
To get better insight to what MarkLogic is doing with search:search, call
search:get-default-options()
to see the starting point for common search applications.

Resources