Note that there are some explanatory texts on larger screens.

plurals
  1. POImage search returns no results
    text
    copied!<p>My Mac recently "retired" so I successfully ported my Rails 2.3.8 app to an Ubuntu installation on Windows. Everything works well except now I don't get any results when I do an image search using my Google custom search (CSE).</p> <p>I have a valid API key and a unique custom search ID - this is confirmed because I get results when executing a regular "web" search using the CSE. I am also well within the daily request limit. I've also double-checked the API reference to ensure that the published syntax hasn't changed and it hasn't.</p> <p>I am issuing the following requests:</p> <pre><code>result_count=10 query='apple' </code></pre> <p><strong>1) Web Search (yields results) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</strong></p> <pre><code>type='' url="https://www.googleapis.com/customsearch/v1?key=#{ENV['GOOGLE_KEY']}&amp;cx=#{ENV['GOOGLE_SEARCH_ID']}#{type}&amp;alt=json&amp;num=#{result_count}&amp;q=#{query}" </code></pre> <p>RESULT => As expected, a JSON-format string with 10 items/results</p> <p><strong>2) Image Search (NO results regardless of query) - - - - - - - - - - - - - - - - -</strong></p> <pre><code>type='&amp;searchType=image' url="https://www.googleapis.com/customsearch/v1?key=#{ENV['GOOGLE_KEY']}&amp;cx=#{ENV['GOOGLE_SEARCH_ID']}#{type}&amp;alt=json&amp;num=#{result_count}&amp;q=#{query}" </code></pre> <p>RESULT => A JSON-format string with 0 items/results, shown below:</p> <pre><code>{ "kind": "customsearch#search", "url": { "type": "application/json", "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&amp;num={count?}&amp;start={startIndex?}&amp;lr={language?}&amp;safe={safe?}&amp;cx={cx?}&amp;cref={cref?}&amp;sort={sort?}&amp;filter={filter?}&amp;gl={gl?}&amp;cr={cr?}&amp;googlehost={googleHost?}&amp;c2coff={disableCnTwTranslation?}&amp;hq={hq?}&amp;hl={hl?}&amp;siteSearch={siteSearch?}&amp;siteSearchFilter={siteSearchFilter?}&amp;exactTerms={exactTerms?}&amp;excludeTerms={excludeTerms?}&amp;linkSite={linkSite?}&amp;orTerms={orTerms?}&amp;relatedSite={relatedSite?}&amp;dateRestrict={dateRestrict?}&amp;lowRange={lowRange?}&amp;highRange={highRange?}&amp;searchType={searchType}&amp;fileType={fileType?}&amp;rights={rights?}&amp;imgSize={imgSize?}&amp;imgType={imgType?}&amp;imgColorType={imgColorType?}&amp;imgDominantColor={imgDominantColor?}&amp;alt=json" }, "queries": { "request": [ { "title": "Google Custom Search - apple", "totalResults": "0", "searchTerms": "apple", "count": 10, "inputEncoding": "utf8", "outputEncoding": "utf8", "safe": "off", "cx": "my_private_cx_id", "searchType": "image" } ] }, "searchInformation": { "searchTime": 0.023136, "formattedSearchTime": "0.02", "totalResults": "0", "formattedTotalResults": "0" } } </code></pre> <p>The image search used to work until I ported the app - I don't know what I'm missing but I suspect it is a minor oversight.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload