Number of results from CSE do not match google total results number - google-custom-search

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.

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

Google Search Api syntax for excludeTerms

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.

Google query for a mass of related websites

Is there a way to load a bunch of urls like a hundred of them and query in google to find other related to those.
To be more specific the command as_rq=www.example.com in google query searches sites that are related to this url, what if I want to search for a vast amount of urls is there an option or I'll have to traverse all the urls one by one.
Unfortunately it is not possible to do multiple url queries. I've tried to do this myself before with no luck after searching multiple online forumns
Yeap it is possible via Google CSE(custom search engine) API where on the required parameter q=exampleQuery you insert q=as_rq=www.example.comand by using annotations you can parametrize your search results.

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

Based on which criteria google AJAX Search API will give search results?

I have used google search API to get the results of google search but it gives me different results as I have searched directly in google.com.
So,if anyone know here how is it possible then let me know.why both results are not same for same search keyword ?
Most likely the filter option for duplicate content and perhaps language option cause the results to differ.