/programmable-search/community?hl=en
This content is likely not relevant anymore. Try searching or browse recent questions.
-
Custom Search engine returns no results programmatically but however displays results in console 1 Recommended Answer 8 Replies 0 Upvotes
1 Recommended Answer
$0 Recommended Answers
1 Relevant Answer
$0 Relevant Answers
I have an application that uses a custom Google search engine to do programmatic searches over a public website. Lately, the search does not seem to be working always as expected. In particular, it may return no results (programmatically) for queries which *do* display results in the (custom search) console. Why is this happening? Is this a bug? Something I have just noticed is that the programmatic API call returns an 'htmlCorrectedQuery' property which has a corrected spelling for the query. However, the corrected spelling appears NOT to be used in the search, and this looks like it may be explaining the 0 results returned vs. the 10000 or so returned for the corrected spelling for this particular query. Shouldn't the programmable search engine also search the 'htmlCorrectedQuery'? (and if not, why include it in the response???). It is disappointing to see the programmable search results being of lower quality than expected. Please advise. Thanks!
Details
Most Relevant Answer Most Relevant Answers (0)
All Replies (8)
Most Relevant Answer
Hi Patricia,

Can you please help me understand your query with more details. Please provide:
1. How have you implemented your Programmable Search Engine?
2. How are you performing query. Please provide me with few example of your query.

Thanks
marked this as an answer
Most relevant based on info available
-
Most Relevant Answer
Hi Deepak, thanks for your reply. My query is done using the node sdk as follows: 
    customsearch.cse.list({
        q: query,
        cx: cx,
        auth: key,
        start: pagesRetrieved*10 + 1
        }, (err, response) => {
             if (err) {
             console.log("Received error from GSC: ", err)
              .....
         }
})
This code is relatively old (it's been in production since 2018 and I noticed that the results obtained have degraded since then). This is being run with query being usually a set of words (there are some filters in place to remove certain other -stop words- from a user-generated phrase). For example: 'achive messages inbox' was the query I followed closely before I posted on Friday. This query, run in the CSE console returns results as expected (using 'archive' instead of 'achive' as a search term). However, within the node program, no results are being returned at all. When I inspected the response returned by the search service, I found the 'spelling' object in the response, with expected values in 'correctedQuery' and 'htmlCorrectedQuery'). 
Let me know if you need more details. Thanks!
marked this as an answer
Most relevant based on info available
Most Relevant Answer
Hi Patricia,

Currently, there are 2 ways you can retrieve results using Programmable Search Engine. 

i) Using the Search Element code. You will need to implement the default element code provided on the search engine control panel on your website. You can test results using the "Public URL" link:

ii) Using CS JSON API. You can enable the API Key from the API console and retrieve results using the Programmable Search Engine ID. The example JSON API query would be like:
https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=Your_Search_Engine_ID&q=<YOUR QUERY>

Which ever way you retrieve  results, there will be spelling correction. When using Search Element code you will see:
Showing results for ......
Search instead for ....

When using CS JSON API, you will see:
}, 
"spelling": { 
"correctedQuery": "......",

If you can provide me with your Programmable Search Engine ID, I'll retrieve  results using both the implementation and check if no results are served.

Thanks
marked this as an answer
Most relevant based on info available
-
Most Relevant Answer
Hi Deepak,
As my earlier response indicates, I am already using the JSON API via node (note: his is used within a bot, so no public search site GUI is being utilized). Id is 013827152706114721592:f3izex1yz8c  . Thanks in advance for looking into it (hopefully you should be able to reproduce my results for that particular search query).
marked this as an answer
Most relevant based on info available
Most Relevant Answer
Hi Patricia,

Performed search with the term "achive messages inbox" (without quotes) using your "Public URL" link and did got results served.

Then performed an JSON API query and was able to reproduce the problem, did not get results served even after spelling correction.

Have reported this to the concern team and will get back once I hear back from them.

Thanks
marked this as an answer
Most relevant based on info available
-
Most Relevant Answer
Thanks so much for reporting this to the team Deepak! I'm glad you were able to reproduce my results. Looking forward to hearing more about this as the team has a chance to respond. Best regards,

-Patricia
marked this as an answer
Most relevant based on info available
-
Most Relevant Answer
Sorry for not replying earlier Deepak (I wasn't notified that there was a reply so did not see it). I think that is unfortunate that the spelling correction is not happening automatically, but at least it looks like I may be able to submit another query, as you suggested, so there is a work-around for the problem. Thanks for looking into this!
marked this as an answer
Most relevant based on info available
This question is locked and replying has been disabled.
Discard post? You will lose what you have written so far.
Write a reply
10 characters required
Failed to attach file, click here to try again.
Discard post?
You will lose what you have written so far.
Personal information found

We found the following personal information in your message:

This information will be visible to anyone who visits or subscribes to notifications for this post. Are you sure you want to continue?

A problem occurred. Please try again.
Create Reply
Edit Reply
Delete post?
This will remove the reply from the Answers section.
Notifications are off
Your notifications are currently off and you won't receive subscription updates. To turn them on, go to Notifications preferences on your Profile page.
Report abuse
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.

Go to the Legal Help page to request content changes for legal reasons.

Reported post for abuse
Unable to send report.
Report post
What type of post are you reporting?
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.

Go to the Legal Help page to request content changes for legal reasons.

Reported post for abuse
Unable to send report.
This reply is no longer available.
/programmable-search/threads
//accounts.google.com/ServiceLogin
You'll receive email notifications for new posts at
Unable to delete question.
Unable to update vote.
Unable to update subscription.
You have been unsubscribed
Deleted
Unable to delete reply.
Removed from Answers
Marked as Recommended Answer
Removed recommendation
Undo
Unable to update reply.
Unable to update vote.
Thank you. Your response was recorded.
Unable to undo vote.
Thank you. This reply will now display in the answers section.
Link copied
Locked
Unlocked
Unable to lock
Unable to unlock
Pinned
Unpinned
Unable to pin
Unable to unpin
Marked
Unmarked
Unable to mark
Reported as off topic
/programmable-search/profile/0?hl=en