domain restriction on php

9 views
Skip to first unread message

macrojd

unread,
Feb 25, 2009, 11:40:54 PM2/25/09
to Google AJAX APIs
Hi. Im using a php script with Json. I want to restrict the search to
1 domain so I do this:

http://ajax.googleapis.com/ajax/services/search/web?v=1.0&safe=off&q=allintitle:anya%20marina%20site:www.myspace.com&rsz=large&hl=en&start=0

I receive 2 results:

1 - http://www.myspace.com/anyamarina
2 - http://www.myspace.com/index.cfm%3Ffuseaction%3Duser.viewProfile

These results are the same if on google.com I do this search:
"allintitle:anya marina site:www.myspace.com"

But there are more useful links that I get when I add the parameter
&filter=0 in the search url. When I do that the results on google.com
will be:

1 - http://www.myspace.com/anyamarina
2 - http://www.myspace.com/index.cfm%3Ffuseaction%3Duser.viewProfile
3 - http://www.myspace.com/anyamarina123
4 - http://www.myspace.com/bathwithasociopath
5 - http://www.myspace.com/bathwithasociopath

As you can see, all the links are relevant (and different), but in
order to get all of them I have to add the parameter &filter=0 on
google.com search.

My question is: How can I do that on PHP Json query? I mean, what I
have to add on this URL in order to get the same result?:

http://ajax.googleapis.com/ajax/services/search/web?v=1.0&safe=off&q=allintitle:anya%20marina%20site:www.myspace.com&rsz=large&hl=en&start=0

I tried the parameter safe=off but didn't work. I tried as_sitesearch
but is only for images I think. So I don't know what to do. In fact,
this is a search engine fail, cause it is hidden important results.

Thanks
JD



Jeremy Geerdes

unread,
Feb 26, 2009, 10:28:03 AM2/26/09
to Google-AJAX...@googlegroups.com
I do not believe that the filter argument is supported by the AJAX
Search API. You might request it in the issue tracker.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
jgee...@mchsi.com

Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!

macrojd

unread,
Feb 26, 2009, 11:30:45 AM2/26/09
to Google AJAX APIs

Hi Jeremy. Well, I found 2 things. One is that the filter parameter
was in the old version of the API, but I can't find it on this version
(Ajax API). And the other thing is that I'm filtering the domain on
the query parameter (q=site:www.domain.com) but I need to do it on the
url. But I don't know how to do this on PHP:

siteSearch.setSiteRestriction("amazon.com");

this is what you do on Ajax scripts, but I don't know what parameter I
need to filter the domain at the same way on PHP url.

Anybody?

Jeremy Geerdes

unread,
Feb 26, 2009, 11:41:03 AM2/26/09
to Google-AJAX...@googlegroups.com
Actually, using .setSiteRestriction in the jsapi essentially tells the
JS to add " site:YOUR_SITE_RESTRICTION" to the end of your query. So
it really is just as though you're calling q=MY_QUERY site:MY_SITE&...

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
jgee...@mchsi.com

Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!


macrojd

unread,
Feb 26, 2009, 12:10:27 PM2/26/09
to Google AJAX APIs
oh crap! my entire application depends on it. So, the main problem
here is that I can't deactivate the filter (bad filter if you ask).
But that option was available on the old API. Must be some way to do
it here.

I need to confirm if this option is really not available and then make
the suggestion (desperated suggestion) on issue tracker, right?

Please if somebody know some way to do it tell me, please.

Bye
JD

Reply all
Reply to author
Forward
0 new messages