Search code examples
google-apisearch-enginegoogle-searchgoogle-custom-searchgoogle-search-api

Use full name as one word using Google Custom Search


I have a list of 14 keywords, as well as the name. I need to send a request through the Custom Search JSON API by building the following query:

"name * keyword1" OR "name * keyword2" OR "name * keyword3" OR ...

If the name consists of only one word, then the request does not exceed the limit of 32 words (which is set in the api), but if it contains more than one word (for example, John Smit), then the limit is exceeded and the result becomes incorrect. Is there any way to force the search to accept the name as a single word?

Or maybe it's worth somehow building a different query? For example something like this:

"name" AND "keyword1" OR "keyword2" OR "keyword3" OR ...

Then there will be 32 - 14 = 18 words left, which should be enough for the name.


Solution

  • Yes, it turned out that everything can be solved by changing the query. The final request looks something like this:

    "name" AND ("keyword1" OR "keyword2" OR "keyword3" OR ...)