Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Search results empty and cursor null
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Shaoxuan Zhang  
View profile  
 More options Nov 6, 1:57 am
From: Shaoxuan Zhang <zsxk...@gmail.com>
Date: Thu, 5 Nov 2009 22:57:47 -0800 (PST)
Local: Fri, Nov 6 2009 1:57 am
Subject: Search results empty and cursor null
Hi all,

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;

}

 </script>

Then in the page

<script type="text/javascript">
            document.write("(" + getQueryReturnCount(<?php echo('"'.
$topissue.'"');?>) + ")");
 </script>

to show the result.

But this code it always gives an error saying the cursor object is
null. I also check the results array, and it is always empty.

Can you please help me find out why the searcher always fail to
retrieve the search results?

BTW: There is also a search div in the same page, using the example
code after getting the API key, and that searcher works fine.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Geerdes  
View profile  
 More options Nov 6, 6:48 am
From: Jeremy Geerdes <jrgeer...@gmail.com>
Date: Fri, 6 Nov 2009 05:48:28 -0600
Local: Fri, Nov 6 2009 6:48 am
Subject: Re: Search results empty and cursor null
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.com
http://jgeerdes.blogspot.com
http://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!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
  !

On Nov 6, 2009, at 12:57 AM, Shaoxuan Zhang wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shaoxuan Zhang  
View profile  
 More options Nov 6, 9:27 pm
From: Shaoxuan Zhang <zsxk...@gmail.com>
Date: Fri, 6 Nov 2009 18:27:07 -0800 (PST)
Local: Fri, Nov 6 2009 9:27 pm
Subject: Re: Search results empty and cursor null
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:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Geerdes  
View profile  
 More options Nov 6, 9:29 pm
From: Jeremy Geerdes <jrgeer...@gmail.com>
Date: Fri, 6 Nov 2009 20:29:44 -0600
Local: Fri, Nov 6 2009 9:29 pm
Subject: Re: Search results empty and cursor null
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

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://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!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
  !

On Nov 6, 2009, at 8:27 PM, Shaoxuan Zhang wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shaoxuan Zhang  
View profile  
 More options Nov 6, 9:43 pm
From: Shaoxuan Zhang <zsxk...@gmail.com>
Date: Fri, 6 Nov 2009 16:43:54 -1000
Local: Fri, Nov 6 2009 9:43 pm
Subject: Re: Search results empty and cursor null
Then how to make that value displayed on the page?

I also want to sort the terms according to that count.

On Nov 6, 2009, at 4:29 PM, Jeremy Geerdes wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google