Renamed module name to google_search (custom_search)

Clean code.
Updated google custom search to handle quota limit and no query submit.
Updated encoding issues for input searches: like "void safe" and "void + safe".
This commit is contained in:
jvelilla
2015-10-14 11:51:59 -03:00
parent 454d92f85b
commit 9263f31521
18 changed files with 435 additions and 256 deletions

View File

@@ -1,28 +1,21 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="gcse" library_target="gcse">
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="gcse" uuid="0B73AB16-3D8A-45EA-84B7-B11BBE4BA80A" library_target="gcse">
<target name="gcse">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" void_safety="none">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
<!--<library name="curl" location="$ISE_LIBRARY\library\cURL\cURL.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
<library name="http_client" location="$ISE_LIBRARY\contrib\library\network\http_client\http_client.ecf"/> -->
<library name="http_client_extension" location="..\http_client_extension\http_client_extension.ecf" readonly="false"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<!--<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri.ecf"/> -->
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
<cluster name="gcse" location=".\src\" recursive="true">
</cluster>
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
<cluster name="gcse" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -19,17 +19,17 @@ feature {NONE} -- Initialization
make (a_query_parameters: GCSE_QUERY_PARAMETERS)
-- Create an object GCSE with query_parameters `a_query_parameters'
do
query_paremeter := a_query_parameters
query_parameter := a_query_parameters
ensure
query_parameters_set: query_paremeter = a_query_parameters
query_parameters_set: query_parameter = a_query_parameters
end
feature -- Access
base_uri: STRING_8 = "https://www.googleapis.com/customsearch/v1"
-- Google custom search base URI
-- Google custom search base URI.
query_paremeter: GCSE_QUERY_PARAMETERS
query_parameter: GCSE_QUERY_PARAMETERS
-- Google custom search parameters.
last_result: detachable GCSE_RESPONSE
@@ -38,7 +38,7 @@ feature -- Access
feature -- Status Reports
errors: detachable LIST [READABLE_STRING_8]
-- optional table of error codes
-- optional list of error messages.
feature -- API
@@ -53,12 +53,15 @@ feature -- API
-- but it's possible to define atom response using the alt parameter.
last_result := Void
if attached get as l_response then
create l_gcse_response
l_gcse_response.set_status (l_response.status)
l_gcse_response.set_status_nessage (l_response.status_message)
if attached l_response.body as l_body then
create l_parser.make_with_string (l_body)
l_parser.parse_content
if l_parser.is_parsed and then attached {JSON_OBJECT} l_parser.parsed_json_object as jv then
if l_response.status = 200 and then l_parser.is_parsed and then attached {JSON_OBJECT} l_parser.parsed_json_object as jv then
-- Queries
create l_gcse_response
if attached {JSON_OBJECT} jv.item (queries_key) as jqueries then
-- Next Page
if attached {GCSE_PAGE} query_page (next_page_key, jqueries) as l_page then
@@ -80,7 +83,8 @@ feature -- API
end
end
end
else
put_error (l_body)
end
else
put_error (l_response.status.out)
@@ -107,7 +111,7 @@ feature {NONE} -- Implementation
new_uri: STRING_8
-- new uri (BaseUri?key=secret_value&cx=a_cx_id&q=a_query
-- ?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures
-- full teamplte BaseUri?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&
-- full template BaseUri?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&
-- safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&
-- googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&
-- siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&
@@ -118,24 +122,24 @@ feature {NONE} -- Implementation
do
create Result.make_from_string (base_uri)
Result.append ("?key=")
Result.append (query_paremeter.secret)
Result.append (query_parameter.secret)
Result.append ("&cx=")
Result.append (query_paremeter.cx)
Result.append (query_parameter.cx)
Result.append ("&q=")
Result.append (query_paremeter.query)
Result.append (query_parameter.query)
-- num
if attached query_paremeter.num as l_num then
if attached query_parameter.num as l_num then
Result.append ("&num=")
Result.append (l_num)
end
if attached query_paremeter.start as l_start then
if attached query_parameter.start as l_start then
Result.append ("&start=")
Result.append (l_start)
end
end
put_error (a_code: READABLE_STRING_GENERAL)
-- put error with code `a_code'.
put_error (a_message: READABLE_STRING_GENERAL)
-- put error message `a_message'.
local
l_errors: like errors
utf: UTF_CONVERTER
@@ -145,35 +149,35 @@ feature {NONE} -- Implementation
create {ARRAYED_LIST [STRING]} l_errors.make (1)
errors := l_errors
end
l_errors.force (utf.utf_32_string_to_utf_8_string_8 (a_code))
l_errors.force (utf.utf_32_string_to_utf_8_string_8 (a_message))
end
item (a_item: JSON_OBJECT): GCSE_PAGE_ITEM
-- Google Result Metadata Item.
do
create Result
if attached {JSON_STRING} a_item.item (create {JSON_STRING}.make_from_string ("kind")) as l_kind then
if attached {JSON_STRING} a_item.item ("kind") as l_kind then
Result.set_kind (l_kind.item)
end
if attached {JSON_STRING} a_item.item (create {JSON_STRING}.make_from_string ("title")) as l_title then
if attached {JSON_STRING} a_item.item ("title") as l_title then
Result.set_title (l_title.item)
end
if attached {JSON_STRING} a_item.item (create {JSON_STRING}.make_from_string ("htmlTitle")) as l_htmltitle then
Result.set_html_title (l_htmltitle.item)
if attached {JSON_STRING} a_item.item ("htmlTitle") as l_htmltitle then
Result.set_html_title (l_htmltitle.unescaped_string_32)
end
if attached {JSON_STRING} a_item.item (create {JSON_STRING}.make_from_string ("link")) as l_link then
if attached {JSON_STRING} a_item.item ("link") as l_link then
Result.set_link (l_link.item)
end
if attached {JSON_STRING} a_item.item (create {JSON_STRING}.make_from_string ("displayLink")) as l_display_link then
if attached {JSON_STRING} a_item.item ("displayLink") as l_display_link then
Result.set_display_link (l_display_link.item)
end
if attached {JSON_STRING} a_item.item (create {JSON_STRING}.make_from_string ("snippet")) as l_snippet then
Result.set_snippet (l_snippet.item)
if attached {JSON_STRING} a_item.item ("snippet") as l_snippet then
Result.set_snippet (l_snippet.unescaped_string_8)
end
if attached {JSON_STRING} a_item.item (create {JSON_STRING}.make_from_string ("htmlSnippet")) as l_html_snippet then
Result.set_html_snippet (l_html_snippet.item)
if attached {JSON_STRING} a_item.item ("htmlSnippet") as l_html_snippet then
Result.set_html_snippet (l_html_snippet.unescaped_string_32)
end
if attached {JSON_STRING} a_item.item (create {JSON_STRING}.make_from_string ("formattedUrl")) as l_formatted_url then
if attached {JSON_STRING} a_item.item ("formattedUrl") as l_formatted_url then
Result.set_formatted_url (l_formatted_url.item)
end
end
@@ -181,22 +185,26 @@ feature {NONE} -- Implementation
query_page (a_page_key: JSON_STRING; a_queries: JSON_OBJECT): detachable GCSE_PAGE
-- Google result medata query. Return a query page based for a query with page key `a_page_key', if any.
do
if attached {JSON_ARRAY} a_queries.item (a_page_key) as jquerypage and then attached {JSON_OBJECT} jquerypage.i_th (1) as jpage then
if
attached {JSON_ARRAY} a_queries.item (a_page_key) as jquerypage and then
jquerypage.count > 0 and then
attached {JSON_OBJECT} jquerypage.i_th (1) as jpage
then
create Result
if attached {JSON_STRING} jpage.item (create {JSON_STRING}.make_from_string ("title")) as l_title then
if attached {JSON_STRING} jpage.item ("title") as l_title then
Result.set_title (l_title.item)
end
if attached {JSON_STRING} jpage.item (create {JSON_STRING}.make_from_string ("totalResults")) as l_results then
if attached {JSON_STRING} jpage.item ("totalResults") as l_results then
Result.set_total_results (l_results.item.to_integer)
end
if attached {JSON_STRING} jpage.item (create {JSON_STRING}.make_from_string ("searchTerms")) as l_search_terms then
if attached {JSON_STRING} jpage.item ("searchTerms") as l_search_terms then
Result.set_search_terms (l_search_terms.item)
end
-- TODO check if we should use INTEGER_64
if attached {JSON_NUMBER} jpage.item (create {JSON_STRING}.make_from_string ("count")) as l_count then
if attached {JSON_NUMBER} jpage.item ("count") as l_count then
Result.set_count (l_count.integer_64_item.as_integer_32)
end
if attached {JSON_NUMBER} jpage.item (create {JSON_STRING}.make_from_string ("startIndex")) as l_index then
if attached {JSON_NUMBER} jpage.item ("startIndex") as l_index then
Result.set_start_index (l_index.integer_64_item.as_integer_32)
end
end
@@ -204,30 +212,15 @@ feature {NONE} -- Implementation
feature {NONE} -- JSON Keys
queries_key: JSON_STRING
do
create Result.make_from_string ("queries")
end
queries_key: STRING = "queries"
next_page_key: JSON_STRING
do
create Result.make_from_string ("nextPage")
end
next_page_key: STRING = "nextPage"
request_key: JSON_STRING
do
create Result.make_from_string ("request")
end
request_key: STRING = "request"
previous_page_key: JSON_STRING
do
create Result.make_from_string ("previousPage")
end
previous_page_key: STRING = "previousPage"
items_key: JSON_STRING
do
create Result.make_from_string ("items")
end
items_key: STRING = "items"
note
copyright: "2011-2015 Javier Velilla, Jocelyn Fiat, Eiffel Software and others"

View File

@@ -6,6 +6,10 @@ note
class
GCSE_PAGE
inherit
DEBUG_OUTPUT
feature -- Access
search_terms: detachable STRING_8
@@ -67,9 +71,10 @@ feature -- Change element
start_index_set: start_index = a_start_index
end
feature -- Output
feature -- Status report
to_string: STRING_8
debug_output: STRING_8
-- <Precursor>
do
create Result.make_from_string ("%NPage details%N")
if attached title as l_title then

View File

@@ -8,7 +8,7 @@ class
inherit
SHARED_HTML_ENCODER
DEBUG_OUTPUT
feature -- Access
@@ -27,9 +27,6 @@ feature -- Access
snippet: detachable STRING_8
-- Snippet of this result
snippet_2: detachable STRING_8
-- Snippet of this result
display_link: detachable STRING_8
-- Display link of this result
@@ -79,7 +76,6 @@ feature -- Element change
-- Assign `html_snippet' with `a_html_snippet'.
do
html_snippet := a_html_snippet
snippet_2 := html_encoded (a_html_snippet)
ensure
html_snippet_assigned: html_snippet = a_html_snippet
end
@@ -143,7 +139,8 @@ feature -- Element change
feature -- Output
to_string: STRING_8
debug_output: STRING_8
-- <Precursor>
do
create Result.make_from_string ("%NPage Item details%N")
if attached title as l_title then
@@ -199,14 +196,6 @@ feature -- Output
end
html_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
do
if s /= Void then
Result := html_encoder.general_encoded_string (s)
else
create Result.make_empty
end
end
note
copyright: "2011-2015 Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"

View File

@@ -1,5 +1,21 @@
note
description: "Represent a google page map"
description: "[
Represent a google page map
"pagemap": {
"cse_image": [
{
"src": "https://www.eiffel.org/portal/files/userpictures/picture-40.jpg"
}
],
"cse_thumbnail": [
{
"width": "81",
"height": "61",
"src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRnC-RKzps6BFItx_MLYBVskFI7U6u0y3VJBInomPYEF5sO6gkip94mLw"
}
]
}
]"
date: "$Date: 2015-10-09 08:11:07 -0300 (vi., 09 oct. 2015) $"
revision: "$Revision: 97973 $"
EIS: "name=PageMaps", "src=https://developers.google.com/custom-search/docs/structured_data#pagemaps", "protocol=url"
@@ -9,20 +25,7 @@ class
feature -- Access
-- "pagemap": {
-- "cse_image": [
-- {
-- "src": "https://www.eiffel.org/portal/files/userpictures/picture-40.jpg"
-- }
-- ],
-- "cse_thumbnail": [
-- {
-- "width": "81",
-- "height": "61",
-- "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRnC-RKzps6BFItx_MLYBVskFI7U6u0y3VJBInomPYEF5sO6gkip94mLw"
-- }
-- ]
-- }
note

View File

@@ -4,6 +4,150 @@ note
Example url template
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
]"
optional_parameters: "[
Optional parameters
c2coff string Enables or disables Simplified and Traditional Chinese Search.
The default value for this parameter is 0 (zero), meaning that the feature is enabled. Supported values are:
1: Disabled
0: Enabled (default)
cr string Restricts search results to documents originating in a particular country.
You may use Boolean operators in the cr parameter's value.
Google Search determines the country of a document by analyzing:
the top-level domain (TLD) of the document's URL
the geographic location of the Web server's IP address
See the Country Parameter Values page for a list of valid values for this parameter.
cref string The URL of a linked custom search engine specification to use for this request.
Does not apply for Google Site Search
If both cx and cref are specified, the cx value is used
cx string The custom search engine ID to use for this request.
If both cx and cref are specified, the cx value is used.
dateRestrict string Restricts results to URLs based on date. Supported values include:
d[number]: requests results from the specified number of past days.
w[number]: requests results from the specified number of past weeks.
m[number]: requests results from the specified number of past months.
y[number]: requests results from the specified number of past years.
exactTerms string Identifies a phrase that all documents in the search results must contain.
excludeTerms string Identifies a word or phrase that should not appear in any documents in the search results.
fileType string Restricts results to files of a specified extension. A list of file types indexable by Google can be found in Webmaster Tools Help Center.
filter string Controls turning on or off the duplicate content filter.
See Automatic Filtering for more information about Google's search results filters. Note that host crowding filtering applies only to multi-site searches.
By default, Google applies filtering to all search results to improve the quality of those results.
Acceptable values are:
"0": Turns off duplicate content filter.
"1": Turns on duplicate content filter.
gl string Geolocation of end user.
The gl parameter value is a two-letter country code. The gl parameter boosts search results whose country of origin matches the parameter value. See the Country Codes page for a list of valid values.
Specifying a gl parameter value should lead to more relevant results. This is particularly true for international customers and, even more specifically, for customers in English- speaking countries other than the United States.
googlehost string The local Google domain (for example, google.com, google.de, or google.fr) to use to perform the search.
highRange string
Specifies the ending value for a search range.
Use lowRange and highRange to append an inclusive search range of lowRange...highRange to the query.
hl string Sets the user interface language.
Explicitly setting this parameter improves the performance and the quality of your search results.
See the Interface Languages section of Internationalizing Queries and Results Presentation for more information, and Supported Interface Languages for a list of supported languages.
hq string Appends the specified query terms to the query, as if they were combined with a logical AND operator.
imgColorType string Returns black and white, grayscale, or color images: mono, gray, and color.
Acceptable values are:
"color": color
"gray": gray
"mono": mono
imgDominantColor string Returns images of a specific dominant color.
Acceptable values are:
"black": black
"blue": blue
"brown": brown
"gray": gray
"green": green
"pink": pink
"purple": purple
"teal": teal
"white": white
"yellow": yellow
imgSize string Returns images of a specified size.
Acceptable values are:
"huge": huge
"icon": icon
"large": large
"medium": medium
"small": small
"xlarge": xlarge
"xxlarge": xxlarge
imgType string Returns images of a type.
Acceptable values are:
"clipart": clipart
"face": face
"lineart": lineart
"news": news
"photo": photo
linkSite string Specifies that all search results should contain a link to a particular URL
lowRange string Specifies the starting value for a search range.
Use lowRange and highRange to append an inclusive search range of lowRange...highRange to the query.
lr string Restricts the search to documents written in a particular language (e.g., lr=lang_ja).
Acceptable values are:
"lang_ar": Arabic
"lang_bg": Bulgarian
"lang_ca": Catalan
"lang_cs": Czech
"lang_da": Danish
"lang_de": German
"lang_el": Greek
"lang_en": English
"lang_es": Spanish
"lang_et": Estonian
"lang_fi": Finnish
"lang_fr": French
"lang_hr": Croatian
"lang_hu": Hungarian
"lang_id": Indonesian
"lang_is": Icelandic
"lang_it": Italian
"lang_iw": Hebrew
"lang_ja": Japanese
"lang_ko": Korean
"lang_lt": Lithuanian
"lang_lv": Latvian
"lang_nl": Dutch
"lang_no": Norwegian
"lang_pl": Polish
"lang_pt": Portuguese
"lang_ro": Romanian
"lang_ru": Russian
"lang_sk": Slovak
"lang_sl": Slovenian
"lang_sr": Serbian
"lang_sv": Swedish
"lang_tr": Turkish
"lang_zh-CN": Chinese (Simplified)
"lang_zh-TW": Chinese (Traditional)
orTerms string Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms.
relatedSite string Specifies that all search results should be pages that are related to the specified URL.
rights string Filters based on licensing. Supported values include: cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial, cc_nonderived, and combinations of these.
safe string Search safety level.
Acceptable values are:
"high": Enables highest level of SafeSearch filtering.
"medium": Enables moderate SafeSearch filtering.
"off": Disables SafeSearch filtering. (default)
searchType string Specifies the search type: image. If unspecified, results are limited to webpages.
Acceptable values are:
"image": custom image search.
siteSearch string Specifies all search results should be pages from a given site.
siteSearchFilter string Controls whether to include or exclude results from the site named in the siteSearch parameter.
Acceptable values are:
"e": exclude
"i": include
sort string The sort expression to apply to the results.
]"
date: "$Date: 2015-10-08 07:51:29 -0300 (ju., 08 oct. 2015) $"
revision: "$Revision: 97966 $"
EIS: "GCSE parameters", "src=https://developers.google.com/custom-search/json-api/v1/reference/cse/list", "protocol=URI"
@@ -46,149 +190,6 @@ feature -- Access : Required Parameters
feature -- Optional Parameters
--Optional parameters
--c2coff string Enables or disables Simplified and Traditional Chinese Search.
-- The default value for this parameter is 0 (zero), meaning that the feature is enabled. Supported values are:
-- 1: Disabled
-- 0: Enabled (default)
--cr string Restricts search results to documents originating in a particular country.
-- You may use Boolean operators in the cr parameter's value.
-- Google Search determines the country of a document by analyzing:
-- the top-level domain (TLD) of the document's URL
-- the geographic location of the Web server's IP address
-- See the Country Parameter Values page for a list of valid values for this parameter.
--cref string The URL of a linked custom search engine specification to use for this request.
-- Does not apply for Google Site Search
-- If both cx and cref are specified, the cx value is used
--cx string The custom search engine ID to use for this request.
-- If both cx and cref are specified, the cx value is used.
--dateRestrict string Restricts results to URLs based on date. Supported values include:
-- d[number]: requests results from the specified number of past days.
-- w[number]: requests results from the specified number of past weeks.
-- m[number]: requests results from the specified number of past months.
-- y[number]: requests results from the specified number of past years.
--exactTerms string Identifies a phrase that all documents in the search results must contain.
--excludeTerms string Identifies a word or phrase that should not appear in any documents in the search results.
--fileType string Restricts results to files of a specified extension. A list of file types indexable by Google can be found in Webmaster Tools Help Center.
--filter string Controls turning on or off the duplicate content filter.
-- See Automatic Filtering for more information about Google's search results filters. Note that host crowding filtering applies only to multi-site searches.
-- By default, Google applies filtering to all search results to improve the quality of those results.
-- Acceptable values are:
-- "0": Turns off duplicate content filter.
-- "1": Turns on duplicate content filter.
-- gl string Geolocation of end user.
--The gl parameter value is a two-letter country code. The gl parameter boosts search results whose country of origin matches the parameter value. See the Country Codes page for a list of valid values.
--Specifying a gl parameter value should lead to more relevant results. This is particularly true for international customers and, even more specifically, for customers in English- speaking countries other than the United States.
--googlehost string The local Google domain (for example, google.com, google.de, or google.fr) to use to perform the search.
--highRange string
--Specifies the ending value for a search range.
--Use lowRange and highRange to append an inclusive search range of lowRange...highRange to the query.
--hl string Sets the user interface language.
--Explicitly setting this parameter improves the performance and the quality of your search results.
--See the Interface Languages section of Internationalizing Queries and Results Presentation for more information, and Supported Interface Languages for a list of supported languages.
--hq string Appends the specified query terms to the query, as if they were combined with a logical AND operator.
--imgColorType string Returns black and white, grayscale, or color images: mono, gray, and color.
-- Acceptable values are:
-- "color": color
-- "gray": gray
-- "mono": mono
--imgDominantColor string Returns images of a specific dominant color.
-- Acceptable values are:
-- "black": black
-- "blue": blue
-- "brown": brown
-- "gray": gray
-- "green": green
-- "pink": pink
-- "purple": purple
-- "teal": teal
-- "white": white
-- "yellow": yellow
--imgSize string Returns images of a specified size.
-- Acceptable values are:
-- "huge": huge
-- "icon": icon
-- "large": large
-- "medium": medium
-- "small": small
-- "xlarge": xlarge
-- "xxlarge": xxlarge
--imgType string Returns images of a type.
-- Acceptable values are:
-- "clipart": clipart
-- "face": face
-- "lineart": lineart
-- "news": news
-- "photo": photo
--linkSite string Specifies that all search results should contain a link to a particular URL
--lowRange string Specifies the starting value for a search range.
--Use lowRange and highRange to append an inclusive search range of lowRange...highRange to the query.
--lr string Restricts the search to documents written in a particular language (e.g., lr=lang_ja).
-- Acceptable values are:
-- "lang_ar": Arabic
-- "lang_bg": Bulgarian
-- "lang_ca": Catalan
-- "lang_cs": Czech
-- "lang_da": Danish
-- "lang_de": German
-- "lang_el": Greek
-- "lang_en": English
-- "lang_es": Spanish
-- "lang_et": Estonian
-- "lang_fi": Finnish
-- "lang_fr": French
-- "lang_hr": Croatian
-- "lang_hu": Hungarian
-- "lang_id": Indonesian
-- "lang_is": Icelandic
-- "lang_it": Italian
-- "lang_iw": Hebrew
-- "lang_ja": Japanese
-- "lang_ko": Korean
-- "lang_lt": Lithuanian
-- "lang_lv": Latvian
-- "lang_nl": Dutch
-- "lang_no": Norwegian
-- "lang_pl": Polish
-- "lang_pt": Portuguese
-- "lang_ro": Romanian
-- "lang_ru": Russian
-- "lang_sk": Slovak
-- "lang_sl": Slovenian
-- "lang_sr": Serbian
-- "lang_sv": Swedish
-- "lang_tr": Turkish
-- "lang_zh-CN": Chinese (Simplified)
-- "lang_zh-TW": Chinese (Traditional)
--orTerms string Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms.
--relatedSite string Specifies that all search results should be pages that are related to the specified URL.
--rights string Filters based on licensing. Supported values include: cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial, cc_nonderived, and combinations of these.
--safe string Search safety level.
-- Acceptable values are:
-- "high": Enables highest level of SafeSearch filtering.
-- "medium": Enables moderate SafeSearch filtering.
-- "off": Disables SafeSearch filtering. (default)
--searchType string Specifies the search type: image. If unspecified, results are limited to webpages.
--Acceptable values are:
-- "image": custom image search.
--siteSearch string Specifies all search results should be pages from a given site.
--siteSearchFilter string Controls whether to include or exclude results from the site named in the siteSearch parameter.
-- Acceptable values are:
-- "e": exclude
-- "i": include
-- sort string The sort expression to apply to the results.
--
num : detachable STRING_8

View File

@@ -18,7 +18,6 @@ class
feature -- Access
current_page: detachable GCSE_PAGE
-- Metadata describing the query for the current set of results.
-- This role is always present in the response.
@@ -75,6 +74,34 @@ feature -- Change Element
end
l_items.force (a_item)
end
feature -- Acess: HTTP Response
status: INTEGER
-- HTTP status code.
status_message: detachable READABLE_STRING_8
-- associated textual phrase for the response status.
feature -- Change Element: HTTP Response
set_status (a_status: like status)
-- Set `status' with `a_status'.
do
status := a_status
ensure
status_set: status = a_status
end
set_status_nessage (a_message: like status_message)
-- Set `status_message' with `a_message'.
do
status_message := a_message
ensure
status_message_set: status_message = a_message
end
;note
copyright: "2011-2015 Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"