Search code examples
bingbing-api

Does the "site:" keyword and other "Advanced Search Options" apply to Bing Custom Search API?


We are using Bing Custom Search, https://learn.microsoft.com/en-us/bing/search-apis/bing-custom-search/reference/endpoints, and passing a site: filter along with the search. The current filter goes something like this:

https://api.bing.microsoft.com/v7.0/custom/search?q=searchTerm site:(support.somesite.com/en-us/productName)-(/productName/2/ OR /productName/3/)

My understanding is this will return results for "searchTerm" in the site support.somesite.com/en-us/productName and exclude sites (urls) containing /productName/2/ or /productName/3/.

The idea is we have a search filter where customers can select specific versions of our product support documentation to search. Selecting the filter excludes other versions of product from search results (i.e. versions /productName/2/ and /productName/3/ are excluded from search results).

However, in practice we are getting search results that contain urls with the versions we hope to exclude.

What is unclear from the documentation - do these https://support.microsoft.com/en-us/topic/advanced-search-options-b92e25f1-0085-4271-bdf9-14aaea720930 "advanced search options" work with the site: keyword as we are attempting to use them above? Or do they only work with the search query?

Is there a good way to exclude particular url paths from the search?


Solution

  • No, Bing Custom Web Search API does not fully support Advanced Search Operators (keywords), which includes the "site:" keyword.

    MS Support pointed out that there is a difference between what is supported in the q= parameter between Bing Web Search API v7 (not used in this question) and Bing Custom Web Search API v7 (used in this question).

    Web Search vs Custom Search q= parameter

    Web Search API v7 documentation (left in image)

    Custom Web Search API v7 documentation (right in image)