https://yandex.<domain>/search/xml ?=<user name> & =<API key> & =<filter type> & [ =<search region ID>] & [ =<notification language>] & [ =<yes>]
Value of the API key that was issued during registration.
Rules for filtering search results (excluding documents from search results based on one of the rules). Possible values:
If the parameter is omitted, moderate filtering is used.
Supported only for “Russian” and “Turkish” search types.
ID of the country or region to search. Determines the rules for ranking documents. For example, if we pass the value “11316” in this parameter (Novosibirsk region), when generating search results, a formula is used that is defined for the Novosibirsk region.
A list of IDs of common countries and regions is provided in the appendix.
Acceptable values depend on the type of search used:
Initiates user verification for possible protection from robots.
The only value used is “yes”.
<?xml version="1.0" encoding="File XML encoding"?> <request> <!--Grouping tag--> <query> <!--Search query text--> </query> <sortby> <!--Type of sorting for search results--> </sortby> <groupings> <!--Grouping parameters in child tags--> <groupby attr="d" mode="deep" groups-on-page="10" docs-in-group="1" /> </groupings> <page> <!--Number of the requested page in search results--> </page> </request>
|request||Grouping tag. Child tags contain parameters of the search query.|
Text of the search query. Instead of special symbols, the corresponding escape sequences must be used.
The query has the following restrictions: maximum query length — 400 characters; maximum number of words — 40.
Rules for sorting search results. Possible values:
If omitted, results are sorted by relevancy.
When sorting by change time, the parameter may contain the order attribute, which is the order for sorting documents. Possible values:
The maximum number of passages that can be used when creating a snippet for the document. A passage is an excerpt from a found document that contains the query words. Passages are used for creating snippets, which are textual annotations to found documents.
Acceptable values — from 1 to 5. The search result may contain fewer passages than the value set for this parameter.
If the parameter is omitted, no more than four passages with the query text are returned for each document.
Number of the requested page in the search output. This determines the range of document positions returned for the request. Numbering starts from zero (the first page corresponds to the value “0”).
For example, if the number of documents returned on a page is equal to “n”, and the value “p” is passed in the parameter, the search results will include documents that fall within the range of output positions from p*n+1 to p*n+n inclusively.
If the parameter is omitted, the first page of search output is returned.
Group tag groupings. The child tag contains parameters for grouping results.
Set of parameters that define the rules for grouping results. Grouping is used to put documents from the same domain in a container. Within the container, documents are ranked using the sorting rules defined in the sortby parameter. Results passed to the container can be used for including several documents from the same domain in search output.
Contains the following attributes:
Sample POST request
The request and request URL shown below return the third page of search results for the query “<table>” for the user “xml-search-user”. Results are sorted by time when the document was changed. Search type: Russian (yandex.ru). Results are grouped by domain. Each group contains three documents, and ten groups can be returned per page. The maximum number of passages per document is two. The service returns an XML file in UTF-8 encoding.
<?xml version="1.0" encoding="UTF-8"?> <request> <query>%3Ctable%3E</query> <sortby>tm</sortby> <maxpassages>2</maxpassages> <page>2</page> <groupings> <groupby attr="d" mode="deep" groups-on-page="10" docs-in-group="3" /> </groupings> </request>