Bei der Gruppe, für die Sie eine Mitteilung verfassen, handelt es sich um eine Usenet-Gruppe. Wenn Sie in dieser Gruppe Nachrichten posten, ist Ihre E-Mail-Adresse für jeden im Internet sichtbar
I am trying to use Google search API to get the estimated result of
some term in my application. The js code looks like:
<script type="text/javascript">
var webSearch;
function getQueryReturnCount(query) {
webSearch = new google.search.WebSearch();
webSearch.execute(query);
return webSearch.cursor.estimatedResultCount;
You can't access the cursor property immediately after running
execute. You have to use the searcher's setSearchCompleteCallback
method to set up a callback which will be run when the search has
returned from Google.
One thing that you should note is that the estimatedResultCount
property is notoriously inaccurate and variable. It should not be used
for anything mission-critical.
Jeremy R. Geerdes
Effective website design & development
Des Moines, IA
When I set a function (assume it call funcA) using the
setSearchCompleteCallback method how should I return the result?
Should it be returned in funcA? Then will the result be returned to
the point where getQueryReturnCount() method is called?
Thanks,
Shaoxuan
On Nov 6, 1:48 am, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> You can't access the cursor property immediately after running
> execute. You have to use the searcher's setSearchCompleteCallback
> method to set up a callback which will be run when the search has
> returned from Google.
> One thing that you should note is that the estimatedResultCount
> property is notoriously inaccurate and variable. It should not be used
> for anything mission-critical.
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
No, it won't be returned to the same point. This is an inherent part
of AJAX technologies. Everything that depends on that count will have
to be called after the callback.
Jeremy R. Geerdes
Effective website design & development
Des Moines, IA
> When I set a function (assume it call funcA) using the
> setSearchCompleteCallback method how should I return the result?
> Should it be returned in funcA? Then will the result be returned to
> the point where getQueryReturnCount() method is called?
> Thanks,
> Shaoxuan
> On Nov 6, 1:48 am, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
>> You can't access the cursor property immediately after running
>> execute. You have to use the searcher's setSearchCompleteCallback
>> method to set up a callback which will be run when the search has
>> returned from Google.
>> One thing that you should note is that the estimatedResultCount
>> property is notoriously inaccurate and variable. It should not be
>> used
>> for anything mission-critical.
>> Jeremy R. Geerdes
>> Effective website design & development
>> Des Moines, IA
> No, it won't be returned to the same point. This is an inherent part
> of AJAX technologies. Everything that depends on that count will have
> to be called after the callback.
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
> On Nov 6, 2009, at 8:27 PM, Shaoxuan Zhang wrote:
>> When I set a function (assume it call funcA) using the
>> setSearchCompleteCallback method how should I return the result?
>> Should it be returned in funcA? Then will the result be returned to
>> the point where getQueryReturnCount() method is called?
>> Thanks,
>> Shaoxuan
>> On Nov 6, 1:48 am, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
>>> You can't access the cursor property immediately after running
>>> execute. You have to use the searcher's setSearchCompleteCallback
>>> method to set up a callback which will be run when the search has
>>> returned from Google.
>>> One thing that you should note is that the estimatedResultCount
>>> property is notoriously inaccurate and variable. It should not be
>>> used
>>> for anything mission-critical.
>>> Jeremy R. Geerdes
>>> Effective website design & development
>>> Des Moines, IA
>>> For more information or a project quote:http:// >>> jgeerdes.home.mchsi.comhttp
>>> ://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com >>> jgeer...@mchsi.com
>>> Unless otherwise noted, any price quotes contained within this
>>> communication are given in US dollars.
>>> If you're in the Des Moines, IA, area, check out Debra Heights
>>> Wesleyan Church!