How to achieve dynamic site search using Custom Search Engine REST API - google-custom-search

Requirement: From my web page user has the ability to add websites and fetch a collection of web pages having the input search term.
We have been using CSE V1 API to extract web pages based on a search term on the desired websites by making use of cref parameter. Since Google stopped supporting Link CSE feature (https://customsearch.googleblog.com/2017/02/refocusing-and-looking-forward-on.html), how do I implement the dynamic site search feature?
Thanks in Advance,
Raghu

On further analysis, custom site search is possible with the siteSearch parameter.
Ref: https://developers.google.com/custom-search/json-api/v1/reference/cse/list#siteSearch.
This parameter accepts only one website as the value, so for multiple website searches, invoke the Google CSE API multiple times for each website.
While creating the search engine, select the option "Search the entire web but emphasise included sites" so that you can hook websites while invoking the CSE API.
To enable siteSearch parameter of API
Hope it helps.
-Raghu

Related

How to monitor usage of Google Custom Search Engine

I'm migrating from Google's Google Site Search (GSS) to Google Custom Search Engine (CSE). I'm using the Atom/JSON API via a PHP library, exactly as I was for my current GSS service. I've created a new CSE search engine in my account and updated the secret key and search engine ID in my PHP configuration.
But I'm not sure how I can monitor the usage of my new CSE search engine? How can I tell whether I've run out of requests? How will I know when I need to pay? In fact, how do I even know that my search requests are going to my new CSE and not to my old GSS?
Is there any sort of logging of searches made using my CSE that I can check?
As a side question, I don't understand how CSE is ad-supported. The Atom/JSON API doesn't seem to include any ads in the results. And even if it did, how can Google force me to display them?
You can get basic usage stats on the Statistics tab (https://cse.google.ca/cse/statistics/stats?cx=) or much more detailed statistics by creating a free Google Analytics account here and then associating it with your CSE by adding your Analytics ID at (https://cse.google.ca/cse/statistics/ga?cx=). The Analytics mobile app (Android or iOS)is pretty slick and can be customized countless ways.

Google Custom search API for BOTS

I am creating a kind of BOT. I would like to add web search functionality to my bot. i.e. I would like my BOT to search the web for user if your says so.
To implement that I am thinking of using GOOGLE search engine. But on overviewPage of its Custom Search API, it says
Create custom search engines that search across a specified collection
of sites or pages.
Is there any way that this specified collection defaults to whole web. or is there another way round this.

Using google custom search API to find images

I want to use Google's Custom Search API to find images using GET request. Like described here. But I don't want to look on images on one specific site, but want to get results like this. How I can do this with the Custom Search API?
Sending this request returns nothing:
https://www.googleapis.com/customsearch/v1?key=[MY_KEY]&cx=017576662512468239146:omuauf_lfve&q=some+request&&safe=off&searchType=image&fileType=png. This cx is from google's manual
I must set cx param, but this value links my request to site, specified in cse control panel. However I don't want to limit my results to one site.
According to the documentation here:
Google Custom Search > Overview
Google Custom Search enables you to create a search engine for your website, your blog, or a collection of websites.
It doesn't sound like that is what you are trying to do (you don't seem to want to search a predefined subset of resources).
I'm aware the question is over 6 years old, but better late than never. It's possible to create a Google programmable search engine that can search the entire web for images. When you create a programmable search engine, there is an option to search the entire web instead of just web sites that you specify. See https://programmablesearchengine.google.com/about/.
As an alternative, you could try Bing Image Search API. There is a limit to the number of image searches you can submit per day for free, but I have rarely hit the limit.

Can I “reuse” Google search results in my application?

I would like to understand if and how it is possible to achieve the following:
Create an app that sends search requests to Google (search requests
inputted by a user!)
Fetch the search results present in a different
format/graphics/layout the search results to the user.
Is that possible or Google would prevent me from doing such a thing? (via a
CAPTCHA for example)
If it is possible what kind of instrument would I need to use to capture (parse?) the search results???
My application would be developed for Android.
Screen-scraping the search results from the Google search site is a violation of their terms of service. I don't think they would use CAPTCHA to prevent you from doing so, but you might get a letter from their lawyers.
However, you could use the Google Custom Search API which allows you to search Google and customize layout of the results. However, you need to acquire a developer key and also follow their terms of service.
Also, Android has a search component built into it that you can probably use. See http://developer.android.com/guide/topics/search/index.html.

Shopify search engine add-on

I'm working on a search engine add-on.
Is it possible to add my search engine add-on into shopify frontpage?
I have research http://www.searchifyapp.com, how they can customize shopify search page?
I am not familiar with searchifyapp.com, so I won't tell you how it works, but I can tell you how it could be done.
If you want to have the shop's data indexed on your search server, then you will want to import the data from shopify on installation and use webhooks for updates. The Syncing with a Store Shopify Wiki page explains how this is done.
You can use ScriptTags to inject javascript into the storefront. Then the javascript can find and enhance/modify the search field/form (e.g. for autocompletion/suggestions as they type, or modify the url for the search results page).
If you want to custom search results (e.g. from your own search server), then you could create an Application Proxy to serve results from your own web application.