Google Search Api syntax for excludeTerms - google-search-api

In the api excludeTerms (string) Identifies a word or phrase that should not appear in any documents in the search results.
If I wanted to exclude job and company what would that look like.
In a google search it would be -job -company, but that does not seem to be working.

Found solution, by experimenting with api explorer.
https://developers.google.com/apis-explorer/?hl=en_US#p/customsearch/v1/
It is just a space between each value.

Related

Search in mutliple sites using Google Custom Search JSON

Trying to figure out how can i search in mutliple sites using Google Custom Search JSON API.
Meaning that search will be only from a specific sites list.
i was playing with the api explorer - https://developers.google.com/custom-search/v1/reference/rest/v1/cse/list?apix_params=%7B%22cx%22%3A%22011602274690322925368%3Atkz2zvvpmk0%22%2C%22siteSearch%22%3A%22www.walla.co.il%22%7D
and noticed the site search query key, but it can only accept a single string not a list of sites:
enter image description here
What is the way to search in only in specific sites?
Thanks
There's a couple things you can do.
If you know the specific sites you want to search, you can add them as refinements to your engine. Then query for that refinement by adding 'more:<REFINEMENT_LABEL>' to the query.
Or, add 'site:' operators to the query itself. For example cats site:cnn.com OR site:bbc.com

How to get such header title and search input in Google search for website

How to get such header title and search input in Google search for website like below:
I am doing my website with core PHP (not any CMS like WordPress, Drupal etc.). So please help me to get such a result in Google.
This is called Sitelinks.
Check it out here: https://support.google.com/webmasters/answer/47334?hl=en
It's an Google automated process and you can't do much to control it. Although a google search on "how to get sitelinks" gives you plenty of results on how to get them, for example, here, or here.
Or perhaps you can purchase them under your AdWords advertisement.
As far as I know, it is much related to PHP. It's more on Search Engine Optimization (SEO).

Multiple file types search using Google Custom Search API

I need to get Google search results for particular filetypes.
For example, in browser I would directly google search for "hyperloop filetype:pdf" and it will list out PDF files for "Hyperloop".
For this, my Google Custom Search request URI will be https://www.googleapis.com/customsearch/v1?key=MY_KEY&cx=MY_UNIQUE_ID&q=hyperloop&fileType=pdf
However, currently I would like to get search results for "hyperloop" of filetypes .ppt or .doc.
In browser, I would achieve this by googling "hyperloop filetype:ppt OR filetype:doc".
What will be my Search request URI equivalent for this query?
I could not find anything related to querying using multiple values for a single parameter in Google Custom Search Documentation.
Rather than doing
q=hyerloop&filetype=pdf
you can use
q=hyperloop%20filetype:pdf%20OR%20filetype:doc
use this its work
$url='https://www.googleapis.com/customsearch/v1?key=AIzaSyCJUGIb_tevRKD-Kxxi5f4&cx=010407088:onjj7gscy2g&q='. urlencode($keywords).'&filetype=doc&filetype=docx';
for me

how to correct spelling mistakes in Google custom API

I am using Google's custom search API, I make an HTTP request to a URL that looks like this:
https://www.googleapis.com/customsearch/v1?key=<my-key>&cref=&num=10&q=how+can+i+do+htis
if you search for "how can i do htis" on Google you are told "Showing results for how can i do this", and give you some results (call them result set A)
but if you use the API to search for the misspelled string, you get different results than those of A... Searching with a correctly spelled string gives you result A, which matches the ordinary search service on Google
Is there a way to search directly using the suggested string? I want to use the API I can't afford implementing a spell checker myself that can also correct people names and everything
I think what you want to do is possible using the spelling suggestions of Google. This is part of the xml-results returned by your query.
See API here.

Number of results from CSE do not match google total results number

In Google Custom Search Engine if I make a search like this:
https://www.googleapis.com/customsearch/v1?key={$apikey}&q=####KEYWORD#####&cref={$cref}&alt=json
with my $apikey and my $cref I get a json results that do not match with the results of google via browser.
I've configured my search engine to search all the web as described here but I've noticed that many results are missing, for example the ones from forums.
Is there a way to specify to CSE to search also the forums? I want to use the same results as google classic search.