Part of canonical.launchpad.utilities.searchservice View In Hierarchy
Implements interfaces: canonical.launchpad.interfaces.searchservice.ISearchService
Method | client_id | The client-id issued by Google. |
Method | site | The URL to the Google Search Engine service. |
Method | search | See ISearchService . |
Method | create_search_url | Return a Google search url. |
Method | _checkParameter | Check that a parameter value is not None or an empty string. |
Method | _getElementsByAttributeValue | Return a list of elements whose named attribute matches the value. |
Method | _getElementByAttributeValue | Return the first element whose named attribute matches the value. |
Method | _parse_google_search_protocol | Return a PageMatches object. |
Google requires that each client of the Google Search Engine service to pass its id as a parameter in the request URL.
The URL is probably http://www.google.com/search.
ISearchService
.
The config.google.client_id is used as Google client-id in the search request. Search returns 20 or fewer results for each query. For terms that match more than 20 results, the start param can be used over multiple queries to get successive sets of results.
Returns | ISearchResults (PageMatches). | |
Raises | GoogleWrongGSPVersion if the xml cannot be parsed. |
The cElementTree implementation does not support attribute selection (@) or conditional expressions (./PARAM[@name = 'start']).
Parameters | doc | An ElementTree of an XML document. |
path | A string path to match the first element. | |
name | The attribute name to check. | |
value | The string value of the named attribute. |
Parameters | doc | An ElementTree of an XML document. |
path | A string path to match an element. | |
name | The attribute name to check. | |
value | The string value of the named attribute. |
PageMatches
object.Parameters | gsp_xml | A string that should be Google Search Protocol version 3.2 XML. There is no guarantee that other GSP versions can be parsed. |
Returns | ISearchResults (PageMatches). | |
Raises | GoogleResponseError if the xml is incomplete. | |
GoogleWrongGSPVersion if the xml cannot be parsed. |