Welcome, guest Sign In

Search Web Services: Contextual Web Search

Submitting Contextual Web Queries

The Contextual Web Search service allows you to search the Internet for web pages using a context-based query. To see an example of Contextual Web Search in action, read about Y!Q. See also the other Web Search services.

Request URL

http://search.yahooapis.com/WebSearchService/V1/contextSearch

Note that due to the context being a potentially lengthy string, contextual searches should be submitted using the POST protocol rather than the GET protocol.

Request parameters

See information on constructing REST queries

Parameter Value Description
appid string (required) The application ID. See Application IDs for more information.
query string The query to search for (UTF-8 encoded). This query supports the full search language of Yahoo! Search, including meta keywords. For details on constructing queries, see Search Tips.
context string (required) The context to extract meaning from (UTF-8 encoded).
results integer: default 10, max 100 The number of results to return.
start integer: default 1 The starting result position to return (1-based). The finishing position (start + results - 1) cannot exceed 1000.
format any (default), html, msword, pdf, ppt, rss, txt, xls Specifies the kind of file to search for.
adult_ok no value (default), or 1 Specifies whether to allow results with adult content. Enter a 1 to allow adult content.
similar_ok no value (default), or 1 Specifies whether to allow multiple results with similar content. Enter a 1 to allow similar content.
language string: default en The language the results are written in. Supported Languages.
country string: default no value The country code for the country the website is located in. Supported Country Codes.
site string: default no value A domain to restrict your searches to (e.g. www.yahoo.com). You may submit up to 30 values (site=www.yahoo.com&site=www.cnn.com).
license any (default), cc_any, cc_commercial, cc_modifiable The Creative Commons license that the contents are licensed under. You may submit multiple values (e.g. license=cc_commercial&license=cc_modifiable).
output string: xml (default), json, php The format for the output. If json is requested, the results will be returned in JSON format. If php is requested, the results will be returned in Serialized PHP format.
callback string The name of the callback function to wrap around the JSON data. The following characters are allowed: A-Z a-z 0-9 . [] and _. If output=json has not been requested, this parameter has no effect. More information on the callback can be found in the Yahoo! Developer Network JSON Documentation.

Sample Request (URL: http://search.yahooapis.com/WebSearchService/V1/contextSearch):

Response fields

The schema document for this service response is located at http://search.yahooapis.com/WebSearchService/V1/WebSearchResponse.xsd

Field Description
ResultSet Contains all of the query responses.
Result Contains each individual response.
totalResultsAvailable The number of query matches in the database.
totalResultsReturned The number of query matches returned. This may be lower than the number of results requested if there were fewer total results available.
firstResultPosition The position of the first result in the overall search.
Title The title of the web page.
Summary Summary text associated with the web page.
Url The URL for the web page.
ClickUrl The URL for linking to the page. See URL linking for more information.
MimeType The MIME type of the page
ModificationDate The date the page was last modified, in unix timestamp format.
Cache The URL of the cached result, and its size in bytes.

Sample response

The following is a sample response for the sample query above:


Rate Limits

The Contextual Web Search service is limited to 5,000 queries per IP address per day and to noncommercial use. See information on rate limiting.

Errors

The Contextual Web Search service returns the standard errors. There are no service-specific errors.

Terms of Use

Please see our Usage Policy to learn about acceptable uses and how to request additional queries.

Support & Community

The Contextual Web Search service is discussed on the yws-search-general mailing list.

Ready to get started?

By applying for an Application ID for this service, you hereby agree to the Terms of Use

YDN LIBRARIES & BEST PRACTICES

YAHOO! APIs & WEB SERVICES

LANGUAGE CENTERS

Copyright © 2008 Yahoo! Inc. All rights reserved. Copyright | Privacy Policy

Help us continue to improve the Yahoo! Developer Network - Send Your Suggestions