0

Using ranking or something else, is it possible to sort the Google/Bing search API results alphabetically by domain name. Within a single response, we can sort the results but I need to sort ALL matching results, i.e. if a search results in 700,000 results then they should be returned (paged) sorted as a whole.

I doubt there is anything like this but may be a workaround?

eth.block
  • 512
  • 1
  • 5
  • 17

1 Answers1

0

One way to do this with the Bing Search API is to use count=50 parameter and get the top results - 50 is the max value. Then extract and sort domains using any sort method such as discussed here: How can I sort a List alphabetically?.

You can also use count and offset parameters to get more results, concatenate domains and sort. For all practical purposes, top 150-200 results will be able to capture most relevant domains. Other results will either have different pages from the same domains or irrelevant domains. Both these APIs anyway won't return 700K or millions of results as mentioned in totalEstimatedMatches parameter. You will most likely get 1000 or 1500 results depending on query (as you go down to explore more results).

Ronak
  • 751
  • 5
  • 10
  • Thanks Ronak. Fetching 4-5 pages in one shot and then paging them internally makes sense. – eth.block Jan 04 '18 at 14:29
  • @Ronak how can add a limit to bing search results `code BingWebSearch($endpoint, $accessKey, $term,$limit);` where `code $limit="&count=1"` same number of results –  Feb 26 '18 at 15:52
  • count=50 will return 50 results for you in the first go. For next set of results - 51st to 100th - you can use offset=50 and count=50. Increasing offset with offset=100 and count =50 will give you 101st to 150th results. You can use any values for count and offset here. – Ronak Feb 26 '18 at 17:59