How to apply keyword search in Bing V7 Search API

Nidhya 0 Reputation points
2023-08-25T04:47:06.4666667+00:00

I would like to use keyword search using the advanced search options such as AND, OR, +, () as per this page in bing search V7 API. It works fine when there are articles related to the given query and applied keyword, but when there are no relevant articles, I'm getting results that are irrelevant to my query.

For example, when I search for "HONGKONG KINGRAY CLOCKS LIMITED" AND ("Money Laundering") it results in articles related to Hong Kong and money laundering.

Search API: https://api.bing.microsoft.com/v7.0/search?q="HONGKONG KINGRAY CLOCKS LIMITED" AND ("Money Laundering")&response_filter=News,Webpages

So my question is, how to avoid getting such loosen results and get only relevant search result? I want to get empty result if there are no relevant news or webpages.

Thanks in advance!

Bing Web Search
Bing Web Search
A Bing service that gives you enhanced search details from billions of web documents.
165 questions
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 48,121 Reputation points Microsoft Employee
    2023-08-25T11:24:03.3333333+00:00

    @Nidhya Try adding "+" before the second part of the search term after AND, I have tried it through bing.com and API and it does not show any results.

    User's image

    Using postman:

    User's image

    With postman, I would be careful while using + since it does not encode correctly on my version. I found this issue from postman repo which suggested using encoded value of + and it works exactly as bing.com response.

    Originally, I think the precedence's came into play, so the results were showing any of the two search terms. With + sign you can be sure that the query does not ignore any terms that you would like to search together. Thanks!!

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.