ImageSearch

69 views
Skip to first unread message

Yves Jacq

unread,
Apr 15, 2012, 5:39:35 PM4/15/12
to Google AJAX APIs
Hello,

I'm trying to configure google custom search to only return images
from my search.
But it also returns web search!
Here is my code:

var customSearchOptions = {};
var imageSearchOptions = {};
imageSearchOptions['layout'] =
google.search.ImageSearch.LAYOUT_CLASSIC;
customSearchOptions['enableImageSearch'] = true;
customSearchOptions['filetype'] = 'jpg';
customSearchOptions['imageSearchOptions'] = imageSearchOptions;

var customSearchControl = new
google.search.CustomSearchControl('015544809827350742733:tb1985qexa8',customSearchOptions);

Can anyone help?

Thanks

omr

unread,
Apr 16, 2012, 9:19:42 AM4/16/12
to google-ajax...@googlegroups.com
This won't eliminate the "Web" tab, but you can easily default to the "Image" tab:

  customSearchOptions['defaultToImageSearch'] = true;

Here is the Custom Search forum:

  https://groups.google.com/a/googleproductforums.com/forum/#!forum/customsearch

  https://groups.google.com/a/googleproductforums.com/forum/#!categories/customsearch

I too have a related question (which I should probably post in that forum rather than here).  (I'm not a lawyer or legal expert.)  IIUC, CSE TOS section 1.4 says we must not "... inhibit the full and complete display of any Results Page ...."  I wonder if we could request an exception or clarification to allow use of CSS to conceal tab headers on a results page (such as the "Web" & "Image" tab headers in this example case)?

-- omr

Yves Jacq

unread,
Apr 16, 2012, 3:31:56 PM4/16/12
to Google AJAX APIs
Thanks for the tip.

But I really nead to completly remove the WebSearch tab.

Anyone has a solution?

On 16 avr, 15:19, omr <omr99...@yahoo.com> wrote:
> This won't eliminate the "Web" tab, but you can easily *default *to the
> "Image" tab:
>
>   customSearchOptions['defaultToImageSearch'] = true;
>
> Here is the *Custom Search forum*:
>
> https://groups.google.com/a/googleproductforums.com/forum/#!forum/cus...
>
> https://groups.google.com/a/googleproductforums.com/forum/#!categorie...
>
> I too have a related question (which I should probably post in that forum
> rather than here).  (I'm *not *a lawyer or legal expert.)  IIUC, CSE TOS<http://www.google.com/cse/docs/tos.html>section 1.4 says we must
> *not** "... inhibit the full and complete display of any Results Page ...."
> * I wonder if we could *request* an exception or clarification to allow use
> of CSS to conceal *tab headers* on a results page (such as the "Web" &

omr

unread,
Apr 16, 2012, 7:25:22 PM4/16/12
to google-ajax...@googlegroups.com
Sorry, my mistake!

I checked the documentation again, and found the option you need:

  customSearchOptions['disableWebSearch'] = true;

Problem solved.

-- omr

Reply all
Reply to author
Forward
0 new messages