/programmable-search/community?hl=en
This content is likely not relevant anymore. Try searching or browse recent questions.
Autocomplete not working even though there are thousands of searches 0 Recommended Answers 3 Replies 12 Upvotes
1 Update
$0 Updates
1 Recommended Answer
$0 Recommended Answers
1 Relevant Answer
$0 Relevant Answers
0
Hello,

We are using a combination of the Programmable Search Element and the Custom Search Site Restricted JSON API. 

We use the element which has this URL: https://cse.google.com/cse?cx=ed6cc5efb57ce455e

Then we redirect to a page which searches using the JSON API and then we render the result with custom HTML. 

Currently there have been around 5000 searches but there is still no autocomplete available. 

We have added a few custom autocomplete and they show up, but nothing else. 

Best regards
Karl
Relevant Answer Relevant Answers (0)
All Replies (3)
Relevant Answer
HI Mobile,

This URL is "Public URL" link which the Admin can use to check if results are being served as per the configuration. This URL is not the correct way of implementing Programmable Search Engine.

If you want to implement Programmable Search Engine using the Element code, you need to select a layout as per your need from the search engine control panel and grab the default code and implement the code on your website which will display the autocompletion on your implemented search box when your user's perform search using this implemented search box.

If you implement using the JSON API then your search box will not display autocompletion.

Thanks
marked this as an answer
Relevant Answer
Hello Deepak,

I think I didn't explain what it is I'm trying to do well enough. 

We use the "Programmable Search Element Control API" in combination with "Custom Search Site Restricted JSON API". 

So first we use the element as below:


<script async="" src="https://cse.google.com/cse.js?cx=ed6cc5efb57ce455e"></script>
<div className="gcse-searchbox-only" id={GOOGLE_SEARCH_BOX_ID} />


Then we use the control API as below (simplified): 

window.__gcse = {
  parsetags: 'explicit',
};

window.google.search.cse.element.render({
  attributes: {
    resultsUrl: '/search',
  },
  div: GOOGLE_SEARCH_BOX_ID,
  tag: 'searchbox-only',
});


So the input we use is the input rendered by Google Search Engine. Then when the search is done, there is a redirect to /search?q=<searchTerm>. (So we already get autocomplete for entries that we added manually, the "custom" autocomplete.) 

Now on this page /search?q=<searchTerm> we use the JSON API to search and we render the results on this page. So it's a combination. 

Would this mean the autocomplete will not work in the search box? The JSON API uses the same search engine ID as the search box. 

Best regards
Karl.
marked this as an answer
Relevant Answer
Hi,

The Search Element code (provided on the search engine control panel) and the JSON API are two separate ways of implementing your Programmable Search Engine.

Clubbing both the implementation is not the recommend way for implementing your search engine. But, if you wish to implement, we will not be able to troubleshoot things.

As updated, when using JSON API, the autocompletion are not displayed. You will need to explicitly only implement Search Element code if you need autocomplete.

Thanks
marked this as an answer
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
Removed from Updates
Marked as Recommended Answer
Marked as Update
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
Known Issue
Fixed
Marked Fixed
Unmarked Fixed
Unable to mark fixed
Unable to unmark fixed
/programmable-search/profile/0