# Summary

Google Custom Search Engine (CSE) is an embedded search engine that can be used to search any set of one or more sites.

# Project URL

https://www.drupal.org/project/google_cse

# Where is the code?

http://cgit.drupalcode.org/google_cse/tree/?h=8.x-2.x

1: https://github.com/skilld-labs/google_cse
2: https://github.com/navneet0693/google_cse/tree/8.x-1.x

# Estimated completion date

Initial port ready

# Dependencies

None

# Who's doing the port?

(People actively working on this, companies funding the effort, etc.)

# What help do they need?

Reviews and improvements

# D8 roadmap

We have moved to PAR process here: https://www.drupal.org/node/2849868. Once this is fixed, maintainers will release dev release from 8.x-2.x branch and 8.x-3.x as a stable release.

# Background and reference information

(Links to any other helpful information, documentation, etc.)

Comments

flaviovs’s picture

Please, see #2540256: Make git repositories standard compliant and in sync. It is OK to track development both in D.o and GH, but the way you are doing (i.e. throughout the use of orphaned branches) is usually not recommended, and it may make difficult to bring D.o in sync in the future.

alexmoreno’s picture

Issue summary: View changes
alexmoreno’s picture

Agree, thank you flaviovs

alexmoreno’s picture

Issue summary: View changes
malcomio’s picture

Title: Drupal 8 version » [google_cse] Google Custom Search Engine
Project: Google Programmable Search Engine » Drupal 8 Contrib Porting Tracker
Version: 8.x-2.x-dev » 8.x-0.x-dev
Component: Code » Module
Issue summary: View changes
malcomio’s picture

Issue summary: View changes
mandclu’s picture

Has there been any consideration to making the D8 port a service class for the Search API instead of a standalone module?

alexmoreno’s picture

sounds reasonably good candidate to be a service, although not sure any of the contributors have time atm :-(

arunkumark’s picture

Assigned: Unassigned » arunkumark

Project looks more complicate am not expertise in drupal so un assigned from this.

arunkumark’s picture

Assigned: arunkumark » Unassigned
mustanggb’s picture

Category: Task » Plan
andypost’s picture

immanuel.paul’s picture

Here is a simpler module that can be of some use

https://github.com/immanuelpaul/gcs

naveenvalecha’s picture

There;s a similar module in the PAs issue queue https://www.drupal.org/node/2724069 can we merge some of its work into the 8.x branch and reuse the code here ?

vprocessor’s picture

Assigned: Unassigned » vprocessor
andypost’s picture

Issue summary: View changes

There's proper merge of ported module https://github.com/skilld-labs/google_cse
Now we need to transfer to maintainers all commits

andypost’s picture

Filed #2754725: Release 8.x-1.x-alpha
Commits authorship should be preserved

vprocessor’s picture

Assigned: vprocessor » Unassigned
andypost’s picture

Status: Active » Needs review

One more porting attempt #2843268: [Meta] Port Google Custom Search Engine to Drupal 8

I think maintainer should decide about roadmap

navneet0693’s picture

I should have payed more attention before I started porting the module. I have almost completed the port and this is a complete d8 port. It will be great if someone can review it. Or, if we can utilize and merge the codes to create a final release.

reid.braswell’s picture

Any updates on this from the maintainers or the port providers?

navneet0693’s picture

@reid.braswell, I am still waiting for the maintainers response, here's my version of port: https://github.com/navneet0693/google_cse/tree/8.x-1.x

alexmoreno’s picture

Thank you navneet for that,

could you guys have a look too at the PR please? @malcomio @andy.post ?

https://github.com/alex-moreno/google-cse/pull/2/files

We'll put this code here once it's reviewed, don't worry about that repo, is just handy to put a few comments.

Thanks

rick hood’s picture

@navneet0693 have you gotten your port to work? (https://github.com/navneet0693/google_cse/tree/8.x-1.x)

I installed it but cannot seem to get it to work and seeing errors such as this:

Notice: Undefined index: sitesearch in Drupal\google_cse\GoogleCSEServices->sitesearchOptions() (line 400 of modules/contrib/google_cse/src/GoogleCSEServices.php).

I have a Google Custom Search Engine ID, but possibly I have something wrong in settings: admin/config/search/pages/manage/google_cse_search

Anyhow, thanks for any feedback.

Rick

navneet0693’s picture

@alexmoreno I have updated the code according to andypost's review !

navneet0693’s picture

@Rick Hood I am trying the module on a fresh installation, if I can reproduce the error, meanwhile I would request you to please tell me the steps you followed.

navneet0693’s picture

Issue summary: View changes
rick hood’s picture

StatusFileSize
new538.21 KB

@navneet0693 Thanks

Steps to reproduce:

1. Enabled the module.

2. Created a search page at admin/config/search/pages with path search/google and I made that the default page.

3. Screenshot of the config screen is attached except with XXXXX:yyyyy for the Google Custom Search Engine ID, in case that is supposed to be private. Note I got it from my client and I am not sure if it is paid version or not. I probably have something wrong in the config there?

4. I placed the Google SCE Search block on a page. The search form shows up there, but returns no results on a search and I have errors on top that include:

Notice: Undefined index: sitesearch in Drupal\google_cse\GoogleCSEServices->sitesearchOptions() (line 400 of modules/contrib/google_cse/src/GoogleCSEServices.php).

Notice: Undefined index: keys in template_preprocess_google_cse_results() (line 43 of modules/contrib/google_cse/google_cse.theme.inc).

User error: Invalid placeholder (!google) in string: !google, or enable JavaScript to view them here. in Drupal\Component\Render\FormattableMarkup::placeholderFormat() (line 235 of core/lib/Drupal/Component/Render/FormattableMarkup.php).

5. Note this is true for my local and my dev, and if it's important, neither of those has a URL with the final domain in it (e.g. myclientdomain.com).

6. Same applies if I go here: /search/google?query=my search text here

Thanks,

Rick

rick hood’s picture

StatusFileSize
new25.26 KB

And attached is what the search results look like.

rick hood’s picture

rick hood’s picture

One more thing, if I go here: https://cse.google.com/cse/publicurl?cx=XXXXX:yyyyy < with the correct key I get results

navneet0693’s picture

@Rick Hood, thank you helping me with these, I am working on them.

navneet0693’s picture

@Rick Hood, I was able to reproduce the issue, that seems to be appearing when you add a google cse block. I am working on it, you can also search using default search form.

rick hood’s picture

@navneet0683 Thank you for working on it, appreciate it!

navneet0693’s picture

@maintainers, I am not sure, but block functioning seems to be broken in Drupal 7 too. We might need to modify js.

kreynen’s picture

@navneet0693 Check your email. @maintainers now includes you

If you can get your work merged into the 8.x-2.x branch of https://www.drupal.org/project/google_cse, we should start opening specific issues there instead of trying to work through multiple issues here.

I really hope is the next update here is to move the status from Needs Review -> Fixed.

navneet0693’s picture

@Rick Hood Please copy the updated code from:

git clone --branch 8.x-2.x https://git.drupal.org/project/google_cse.git

Known issue is: Google CSE block is unable to search.
Work around: You can use default search form.

navneet0693’s picture

Issue summary: View changes
Status: Needs review » Fixed
Related issues: +#2849854: Push code from git repo to 8.x-2.x branch of module

The code is now available at 8.x-2.x branch of Google CSE module, here: http://cgit.drupalcode.org/google_cse/tree/?h=8.x-2.x

Thank you everyone who made this possible. Please file bugs in issue queue of module here: https://www.drupal.org/project/issues/google_cse.

rick hood’s picture

StatusFileSize
new1.24 MB
rick hood’s picture

@navneet0693

Thanks for your work on this.

This morning I grabbed this: git clone --branch 8.x-2.x https://git.drupal.org/project/google_cse.git

I uninstalled the version I had installed, then re-installed this new version, just in case it had any database changes. I setup a Google CSE Search page at /admin/config/search/pages and made it the default. The other two search pages listed there are Content and Users, which comes with D8 core.

In comment #37 you say:
Known issue is: Google CSE block is unable to search.
Work around: You can use default search form

So, I enabled the regular search form, not the CSE search form.

I now get search results when using that form. That form is “A” in the attached screenshot (Search---CSE.jpg), and in the screenshot you can see the results. You can ignore the search box “B” that is shown, which is part of my template and is where I need to move A to.

But two issues:

1. I get these 2 errors:

Warning: strpos() expects parameter 1 to be string, object given in Drupal\Component\Utility\UrlHelper::stripDangerousProtocols() (line 347 of core/lib/Drupal/Component/Utility/UrlHelper.php).

Warning: htmlspecialchars() expects parameter 1 to be string, object given in Drupal\Component\Utility\Html::escape() (line 421 of core/lib/Drupal/Component/Utility/Html.php).

2. The search box that appears with the results (“C”) does not work. When I submit something with that form, the URL is this: search/google?query=art (not ?keys=art). Worst case I probably do not need that search box so could hide it, but just letting you know.

Anyhow, this is my input for now.

Thanks,

Rick

BTW I should have mentioned before but I am on Drupal 8.2.4

More, for clarity in case not clear: when I use search box "A" I get results, when I use "C" I do not.

navneet0693’s picture

Issue summary: View changes

@Rick Hood You are so right! I encountered them, I will working on them around to get those resolved at earliest possible. I have opened an issue in PA https://www.drupal.org/node/2849868 to get it through PAR process so once this is fixed and we are quite sure about not breaking anything, we will be to create a release of module :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.