Well, the first thing you need to do is set up your CSE. Follow this link:
http://www.google.com/coop/cse/ Then check out this example in the API playground: http://code.google.com/apis/ajax/playground/#restrict_by_cse Notice how, instead of using two different setSiteRestriction calls to restrict to two different sites, you need to use one setSiteRestriction call to restrict to your custom search engine. The key is in this line: webSearch.setSiteRestriction('017576662512468239146:omuauf_lfve', 'lectures'); For documentation on the functionality, check out the link below: http://code.google.com/apis/ajaxsearch/documentation/reference.html#_class_GwebSearch 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 [email protected] 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 ! On Aug 23, 2009, at 11:08 PM, greenhorn wrote: > > I feel you have understood my question. Thanks, As your quote "You > can > then pull results from your CSE using the AJAX Search API simply by > providing the CSE id to the setSiteRestriction method. ", this is > exactly what i need. Code sample please > > i have tried code sample this way not worked :( , it had just > overwrite older url. How do i put 2nd url. > > =============================================== > --> siteSearch.setSiteRestriction("www.amazon.com"); > --> siteSearch.setSiteRestriction("www.ebay.com"); > =============================================== > > Thanks & Regards > Dilip > > On Aug 21, 4:45 pm, "Jeremy R. Geerdes (Debra Heights Wesleyan - Des > Moines)" <[email protected]> wrote: >> If I'm understanding you correctly, you want to use the same searcher >> to search two different sites (even though your code is only set up >> for amazon.com). Although you used to be able to do this with the >> site: search operator, the functionality seems to have been disabled. >> The only other option that I know of would be to set up a custom >> search engine that would search only amazon.com and ebay.com . You >> can >> then pull results from your CSE using the AJAX Search API simply by >> providing the CSE id to the setSiteRestriction method. >> >> Jeremy R. Geerdes >> Effective website design & development >> Des Moines, IA >> >> For more information or a project quote: >> [email protected] >> >> On Aug 21, 6:05 am, greenhorn <[email protected]> wrote: >> >>> Google search API >>> ============== >> >>> I need to use restricted search for coupleof web sites >> >>> let say i need to get search bothwww.amazon.com andwww.ebay.com&i >>> need to dispay it under " books " result coustom label >> >>> " siteSearch.setSiteRestriction("www.amazon.com");" ? how do i add >>> search for above both sites ? >> >>> I couldnt find way to search both sites. I was able to set search >>> one >>> web site ("www.amazon.com") as shown in below custormized sample. >> >>> Please Help ...!! >> >>> Does anone had clear API documention of Google search api ????/ >> >>> ========================================================== >>> <script language="Javascript" type="text/javascript"> >>> //<![CDATA[ >>> google.load("search", "1"); >>> function OnLoad() { >>> var siteSearch = new google.search.WebSearch(); >>> siteSearch.setUserDefinedLabel("books"); >>> siteSearch.setUserDefinedClassSuffix("siteSearch"); >>> siteSearch.setSiteRestriction("www.amazon.com"); >> >>> // Create a search control >>> var searchControl = new google.search.SearchControl(); >> >>> searchControl.addSearcher(siteSearch); >> >>> } >>> google.setOnLoadCallback(OnLoad); >>> //]]> >>> </script> >>> =========================================================== > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en -~----------~----~----~----~------~----~------~--~---
