How to get results for a specific country/region only, via Google AJAX Search or Custom Search APIs? - ajax

I just want to specify a region and a search phrase, and retrieve the URLs of the top 10 result pages for that search phrase/region from Google...

Add &gl=country_code to the request URL
Example:
http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=music&gl=in

Related

FHIR Page number support

Foe search interactions, while there is support for specifying the number of items expected in the response using the _count parameter, we are not able to find any reference to a parameter to specify the page number.
The _query parameter can be used for custom queries, but is that an option or is there a better alternative.
For example, what is the standard way to request for the second page of a patient resultset with each page having 10 records? -
GET Patient?_count=10&[pagenumber?]=2
There's no mechanism to navigate to a specific page. You use the URLs provided in Bundle.link (e.g. previous, next, first, last) to navigate through the search result set.

How do I restriction a Google Places Search to a specific country?

The documentation says how I can limit searches to a country by using componentRestrictions. However, the documentation apparently only relates
to JavaScript.
I'm doing a regular request from a PHP application, and need to limit a place
search to a country. However, I can't see how I can limit search results to a country using a regular GET request.
I believe you can just add components=country:XX to your request URL :)

Search Appliance - Multiple site search from sitesearch parameter

I am trying to use the google search appliance to search multiple URLs without listing them within the search query prefixed with site:.
Normally you would search a single URL in this way like this:
http://www.google.com/#hl=en&q=everyone&sitesearch=ebay.com
And we could search multiple URLs WITH them in the query string like this:
http://www.google.com/#hl=en&q=everyone+site%3Aebay.com+OR+site%3Abestbuy.com
What I want is something where we pull info from both URLs without it being listed in the query string. Something like this (but this doesn't work):
http://www.google.com/#hl=en&q=everyone&sitesearch=ebay.com+AND+bestbuy.com
There is a parameter called site which refers to the collection. In the collection configuration you can specify which url patterns you want to make up the search results.
See this Link

How to get number of search result from Bing API

I want to use bing search api to obtain search result count for given query, however, Bing API seem to not return any fields containing the search result count.
Should I specify some option to request URL? Or Bing API not return the result countt?
You can obtain the result count, but it's not as obvious as I thought it would be.
Using this URL:
https://api.datamarket.azure.com/Data.ashx/Bing/Search/v1/Composite?Sources=%27web%27&Query=%27YOUR_QUERY_HERE%27&$top=1&$format=JSON
you can get a JSON String, which includes the result count in
d->results[0]->WebTotal
You need to use the Composite search for that (I specified only web in this example, but you can use web+news or any other bing source) and you have to retrieve at least one result ($top=1).
You can also use Atom instead of JSON to get an xml response.
For those subscribed to the SearchWeb stream rather than the general Search, the URL is this:
https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/v1/Composite?Query=%27YOUR_QUERY_HERE%27&$top=1&$format=JSON
As with Wang Tang's answer, the result should include
d->results[0]->WebTotal
You can get the results count from the result object:
results_object['searchResults']['webPages']['totalEstimatedMatches']

How to write a Google Analytics filter to record site searches

I what to record all my website searches with google analytics but the problem is my search links look like this
**www.mywebsite.com/search/category/your+query+here**
From what i found out i must give GA the query parameter (mywebsite.com/search.php?q=your+query+here) but i have none (and don't want any).
Is there a way to rewrite the URL with a google analytics filter? If yes how.
Yes, you can create a custom filter that rewrites URL /search/<category>/<query> to ?q=<query>&c=<category>.
Go to Analytics Settings › Filter Manager, and click Add Filter. Choose Custom Filter in the Filter Type drop-down list, select Search and Replace radio button, and then set two Request URI fields with the corresponding values. For further details, see ’How do I create a filter?’ page in Google Analytics Help Center.
Keep in mind! Since past visitor data cannot be reprocessed, always keep a ’raw’ profile that you do not apply filters against. For further details, see chapter ’Best Practices for Filters & Profiles’ in presentation ’Filters in Google Analytics’.
Site Search is processed BEFORE Filters are applied.
I went through a week of testing to realize this. Yes, the Filter logic is correct, but as of Nov 1, 2009 this will not work with Site Search.
We accomplished this by appeding the ?search= parameter to the page URI in the GA script. Then we strip search params in the Profile Settings and we get the pure URI's in the content section as well as the Searches tracked in Site Search.
I know this is old, but to expand on the prev accepted answer, use a 'virtual url' in the _trackPageview call, so for www.mywebsite.com/search/category/your+query+here have
gat._trackPageview( "/search/content/your+query+here?query=your+query+here&cat=category" )
This means that URLs won't be changed, so everything else works (as noted in the previous answer) - if you really want to you could remove the search params, but unless you're running into a URL limit I'd probably prefer to keep them present so they can be seen in the content reports.

Resources