How do a make a custom Google search?
I would like to make a (html) form which enables me to do a custom Google search query. If I enter for example 10 keywords in a text area (every line contains a word), I should see how much "Estimated results" there are for every keyword.
I think I should use the Google AJAX Searcg API, but I don't really understand how to use it exactly.
I read this:
google.search.Search - Properties
.estimatedResultCount - supplies the estimated number of results that match the current query. Note that this value will not necessarily match the similar value thats visible on the Google.com search properties.
So I need to use the method mentioned above. But how? I don't expect to to get the full working thing as a reply. I know enough JS to read the words for example. But how to work with the Google API, let alone the method for Estimated search results isn't yet my cup of tea :-).
Thanks in advance,
2. You'll need to get a special API key:
3. Write a simple, test HTML page that:
a) loads the Google Ajax API:
Here's a complete example, with all of the above steps:
Here's another (complete) example that:
a) loads the Google API
b) registers a callback for "search complete"
c) invokes the search
d) uses the callback to update some dynamic HTML
'Hope that helps .. PSM
So I started with the first link you gave. I added this (in a nutshell):
var cursor = gSearch.cursor;
var estCount = cursor.estimatedResultCount;
1) Using my app, when I enter a word, the app gives me the estimatedResultCount. But the result count is nothing near to what www.google.com gives me. I know that it's normal that there is a slight difference between the catch and the real think, but take a look at this:
using my app (http://deblanger.be/estResults/:
myQuery : 96,200 estimated results.
About 716,000 results (0.25 seconds)
So what causes this huge difference?
2) If I enter 20 words in the textarea, the app should look for every word individualy, and not see the 20 words as one string. Do you (someone) know how to do this?
Thanks in advance.
Take a look at this:
The application works, although the results are totally different from those that you find if you google.com them. As I mentioned before: it's normal that the 2 results (http://deblanger.be/estResults/ & www.google.com) aren't perfectly the same. But the differences between the results that I get are to big to be 'normal'.
|All times are GMT -5. The time now is 11:56 PM.|