Re: Simply getting spell and suggestions from a search term

466 views
Skip to first unread message
Message has been deleted

Jeremy Geerdes

unread,
Jan 8, 2013, 12:14:38 PM1/8/13
to google-ajax...@googlegroups.com
Allow me to answer your questions as you asked them.

We're going to make a site with non-public pages. Can I use the Google Search APIs? You can utilize the APIs in a wide variety of applications, but don't expect non-public pages or sites to appear in search results.

If we would use the normal Google search we have to use the expensive solution with the Google server, so we want to make our own. As stated above, the API won't return anything that's not public. Further, you should be advised that the Web/AJAX Search API has been deprecated and slated for discontinuation later this year. Its successor, the Custom Search API (CSAPI), offers only 100 complimentary requests per day. If your application is going to require more queries, you will need to enable billing, which will result in charges of USD5 per 1000 queries, with a maximum of 10000 queries per day.This could amount to as much as USD50 per day.

We want Google functions like "Did you mean..." Google does not offer a public API for this service.

The PHP script you've included utilizes the non-public completion service. There is no TOS or documentation for this service. It is therefore considered illegal for you to use. Moreover, if you would reverse engineer the service, there would be no way to guarantee that Google won't simply change the spec again and break your app once more. Using this script or any similar script to access a non-public Google service would therefore be highly inadvisable.

Is it true that the new Google API will offer properly spelled words and suggestions? No. There is no such Google API.

Is it possible to make my own search bar, with various Google functions built in? When you utilize the Web (AJAX) Search API or CSAPI, you can build a custom search form AS LONG AS you abide by the branding requirements in the TOS. As stated above, though, the autocomplete and search suggestions services are not available to you.

Would the PHP Google APIs client be good for me to use? That client was built to interface with any of the services available through the API Console and Discovery service. Therefore, if you're going to use the CSAPI, it will certainly work for you. However, it will not allow you access to spelling and related search suggestions, and as stated before, it won't be able to help you get results from non-public resources.

Hope this helps.

jg

On Tue, Jan 8, 2013 at 7:42 AM, <ba...@impression.nl> wrote:
hey,
I'm searching a while for much google search api's, and i think i'm on the right way, but before digging deeper into it, could someone say me if the following is possible?
- were going to make a site with non public pages
- if we would use the normal google search we have to use the expensive solution with the google server, so we want to make an own.
- we allready have a search system build in, but that only searches to the search term and part of the search term
- we want the google functions like "did you mean...." when its wrong spelled, and an list of suggestions of related searches.
- i saw an older script, but after long searching why it dont work, i saw that the used api was depricated by google. it should be an ajax page from a java for dummies book, here it is:

NOTE TO USERS WHO COME HERE BY SEARCHING THIS SCRIPT, IT SEEMS TO NOT WORKING ANYMORE!
google.php:
<?php

$handle = fopen("http://www.google.com/complete/search?hl=en&js=true&qu=" . urlencode($_GET["qu"]), "r") . "&output=toolbar";
echo "test";
while (!feof($handle)){
$text = fgets($handle);
echo $text;
}
fclose($handle);
?>
index:
<html>
<head>
<title>Google live search</title>
<style>
#targetDiv {
background-color: #FFEEAA;
width: 30%;
}
</style>
<script language = "javascript">
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp");
}
function getData(dataSource){
if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function() {
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
eval(XMLHttpRequestObject.responseText);
}
}
XMLHttpRequestObject.send(null);
}
}
function getSuggest(keyEvent) {
keyEvent = (keyEvent) ? keyEvent: window.event;
input = (keyEvent.target) ? keyEvent.target : keyEvent.srcElement;
if (keyEvent.type == "keyup") {
if (input.value) {
getData("google.php?qu=" + input.value);
}
else {
var targetDiv = document.getElementById("targetDiv");
targetDiv.innerHTML = "<div></div>";
}
}
}
function sendRPCDone(unusedVariable, searchTerm, arrayTerm, arrayResults, unusedArray){
var data = "<table>";
var loopIndex;
if (arrayResults.length != 0) {
for (var loopIndex = 0; loopIndex < arrayResults.length; loopIndex++) {
data += "<tr><td>" + "<a href=’http://www.google.com/search?q=" + arrayTerm[loopIndex] + "‘>" + arrayTerm[loopIndex] + ‘</a></td><td>’ + arrayResults[loopIndex] + "</td></tr>";
}
}
data += "</table>";
var targetDiv = document.getElementById("targetDiv");
targetDiv.innerHTML = data;
}
</script>
</head>
<body>
<H1>Google live search</H1>
Search for <input id = "textField" type = "text" name = "textField" onkeyup = "getSuggest(event)">
<div id = "targetDiv">
<div></div>
</div>
</body>
</html>

- when you put only a few characters in it, it allready gives you the search suggestions like google search also does. but as i said, it does not work anymore :( (if someone knows a way to repair this one it would be the best, because its much more simple to implement i think, and not max 100 a day)

- so now i'm searching to do this simple thing by a api. at all the api code i found, its seemed that the new one also has the functionality to put through the suggestions and well spelled word at mis spelling. is that true?

- in the "hello world" examples i only get the google search bar. is it possible to make my own search bar, with the google functionality in it? what i want to make:
  - input field (so i can send it to my own search page instead of google search)
  - search buttom
  - when something is typed into the search box, it has to load the google suggestions.
  - when a search is done, i want to check if google has an other spelling, so i can show a "did you mean" link.

is this possible, and does someone has some tips for me what parts of the api to use? i saw an php api client: http://code.google.com/p/google-api-php-client/ i think this one would be good for me to use?

Bart

--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to
google-ajax-searc...@googlegroups.com
To view this message on the web, visit
https://groups.google.com/d/msg/google-ajax-search-api/-/51GAoWlKZeoJ
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en



--
Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

ba...@impression.nl

unread,
Jan 8, 2013, 6:15:58 PM1/8/13
to google-ajax...@googlegroups.com
just a quick answer from my phone, how i read this there is no way i can do what i want?
- you say there is no spelling / sugestion in the new api? whats the spelling suggestion than when you look at xml under the s? https://developers.google.com/custom-search/docs/xml_results?hl=en#results_xml_tag_Suggestion
- is there no way to return that xml without using the pre delivered google search bar?
Reply all
Reply to author
Forward
0 new messages