I think I might try just making a custom block to get the job done, but I was wondering if it would be incorporated into the adSense module.

Great module by the way!

Thanks,
Chris

Comments

kbahey’s picture

If you (or anyone else) can incorporate that feature as a patch, I will include it in the base functionality of the module.

yas’s picture

Version: 5.x-1.2 » 5.x-1.6
Status: Active » Needs review
StatusFileSize
new33.42 KB

I made a patch for AdSense for Search. I feel it might be necessary for the administration UI to improve in order to coexist with the existing feature.

After applied this patch, go to admin/user/access and enable 'adsense search result page' access control.

--- yas

yas’s picture

StatusFileSize
new33.41 KB

I found myself the patch included a bug that the search results was not based on the specified domain. I fixed it so please try this one.

--- yas

vjuhasz’s picture

Category: feature » support

I installed it, but wondering how this search works, if my site's content is stored in the database. This works only for Google search, or in-site search as well?
Thanks, Val

yas’s picture

Hello vjuhasz,

The short answer is "This patch works only for Google search".

This feature presumes your site's contents are public/open/accessible to the Internet and being registered as 'index' in Google (Google's database).

So, if your site's contents are public to the Internet and every single page in your site has been already registered as index into Google, what is the advantage of AdSense for Search?

1. Extremely faster than Drupal's default in-site search
2. Integrated to your site design seamlessly if you apply this patch :)
3. May earn a little by AdSense (but IMO this is a quite minor point because the click rate of AdSense for Search might be even lower than AdSense for Content.)

If your site's contents are not public, this means, your site's contents are stored only in the database or your site's contents only can be seen after logging into your site, you can only use in-site search of Drupal's default search module.

HTH

Artem’s picture

subscribing

kbahey’s picture

Status: Needs review » Needs work

@yas, thanks a lot.

I tested this and it works. I committed it to 5.x, but it needs some more work.

Can the results from Google be themed using "group" to change the colors, fonts ...etc.?
Can the same be done via "group" to the search box and button?

yas’s picture

StatusFileSize
new34 KB

kbahey,

Thank you for applying my patch.

I have to report that I was warned by Google using 'adsense_for_search_1.patch' because the patch wasn't the same as the Google's original code (I omitted the radio buttons, etc).

So I _precisely_ reproduced the AdSense for Search code in this 'adsense_for_search_2.patch' except one thing --- using 'as_q' instead of 'q' as a query string parameter.
I have been running my multiple sites with this patch for almost two months, then I have never warned by Google so far.

Please test/evaluate this patch.

Thanks in advance.

yas’s picture

kbahey,

> Can the results from Google be themed using "group" to change the colors, fonts ...etc.?

Yes.

> Can the same be done via "group" to the search box and button?

No, however, you can customize your search box and button with your css like this:

#####

.adsense_search tbody {...}
.adsense_search table {...}
.adsense_search td {...}
input #sbi {...} /* search box */
input #sbb {...} /* search button */

##### example:

.adsense_search tbody {border-top: none; text-align: center; padding: 0 0 0 0;}
.adsense_search table {background: none; border: none; margin: 0; width: 200px; clear: right; padding: 0 0 0 0;}
.adsense_search td {border: none; padding: 0 0 0 0;}
.adsense_search td:hover {background: none;}
input #sbb {padding: 0 35px 0 35px;}
#googleSearchUnitIframe {text-align: center;} /* alignment of the search result from Google */

#####

kbahey’s picture

Version: 5.x-1.6 » 5.x-1.x-dev

Please download the -dev version, and create a patch against it, and I will test and apply it.

yas’s picture

StatusFileSize
new33.58 KB

kbahey,

I remade the patch for ver. 1.50.2.24.
I hope this one will meet your expectation.

kbahey’s picture

No

There are still too many changes in this patch without need.

Start with the latest -dev, and make the change ONLY for the things that Google objected to.

Do not move code around and make the patch too big to review.

kbahey’s picture

Hi.

Can you please roll the patch that corrects Google's code against the version in the repository, so it has less lines to review?

Also, it would be nice to log the search terms in watchdog, just like Drupal's search module did.

Let me know if you will do this soon, or we should wait for a while.

yas’s picture

StatusFileSize
new22.5 KB

kbahey,

Sorry for my late response because last week I was busy for studying in order to prepare a difficult interview of a certain company.

I wish I would make it this time around --- less lines to review.
Logging the search terms in watchdog is included.

kbahey’s picture

I hope the interview went well.

I applied the patch to the repository, with a lot of changes for code style.

It makes some sites look really ugly though, check Egyptian Cuisine Recipes. but that is Google's fault, not the module. I will ask Google if the buttons can be styled or something. They have said no in the past.

One more thing: Google allows the background to be configurable with an HTML code. We already have "groups" for color. So can you change the settings instead of selecting a background color as black, white, gray, it can be a group, and the group's background color will be chosen.

First, please delete your copy of adsense.module and refresh from the CVS repository before you modify the code and create a patch.

kbahey’s picture

And the code can be made to be XHTML compliant as well, simply by removing 2 closing tags.

Details on Google's Adsense help.

kbahey’s picture

yas.

To be clear: I already did the change in #16 so the code is XHTML compliant. You do not need to do it. Just work on #15 when you can. I asked Google about changing the search code to allow styling, and waiting for the reply.

yas’s picture

kbahey,

Thank you for applying my code.

1. Background

Have you already tried to modify your css with .adsense_search table as #9 that I posted?
My code is supposed to output <div class="adsense adsense_search"> ... </div> tag, so I think you can solve this issue without any alterations of your adsense for search code by specifying no table's background in your css like this:

.adsense_search table {
background: none;
}

Just add one line above into your css.

2. Button

Also you can make change button appearance with your css like this:

.adsense_search input {
background-color: #FFF;
color: #999999;
font-size: 12px;
padding: 2px;
margin: 2px 0px 2px 0px;
border: 1px solid #CCC;
}

Please try 1. and 2. above in your css.
Any modification of adsense for search code will result in Google's warning as I have already been done, so don't do that.

The example sites are:

http://perltips.twinkle.cc/
http://bayarean.twinkle.cc/ (I am applying a GIF image to the button, it is working well in Firefox, but IE is not)
http://recipe.2kids.net/

HTH

kbahey’s picture

Status: Needs work » Fixed

Thanks for the hint.

What I ended up doing is this:

#sbb {
 /* button styling goes here */
}

#sbi {
 /* text box styling goes here */
}

Good thing Google has CSS ids for these elements.

What I cannot do is reduce the width of URL listed in the radio button ...

Marking this as fixed.

Thanks again.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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