I'm using boss.search table to extract the data in XML, but I would like to retrieve specific fields.
The standard syntax is:
SELECT * from boss.search WHERE q="stackoverflow" AND ck = 'ConsumerKey' AND secret = 'ConsumerSecret';
which works.
But when I'm trying to select fields like "/title" or "/results/result/title", I've got the syntax error:
Query syntax error(s) [line 1:7 expecting fields_or_star got '/result/title']
What's the correct syntax of retrieving fields (such as title)?
The REST response looks like:
<results>
<bossresponse>
<web>
<results>
<result>
<date/>
<clickurl>https://example.com/</clickurl>
<url>https://example.com/</url>
<dispurl type="default">https://example.com/</dispurl>
<title type="default">Example</title>
<abstract type="default">Example</abstract>
</result>
<result>
You can check that at 'Syntax of SELECT - Specifying the Elements Returned' (cached) Yahoo Query Language documentation.
If the fields in the result set contain sub-fields, you can indicate the sub-fields by using periods (dots) as delimiters.
Custom tables
For example, for the
social.profiletable, to get only theimageUrlsub-field of theimagefield from the following example:enter the following:
BOSS API
In BOSS response it's a bit different. To get title from boss.search table, you need to name the field as:
web.results.result.title, e.g.HTML
To get just the content from an HTML page, you can specify
contentkeyword after the wordSELECT. A statement with thecontentkeyword processes the HTML in the following order:contentwithin the elements found.contentis not found, the statement looks for an attribute namedcontent.contentis found, the statement returns the element'stextContent.For example, the following statement extracts only the HTML links (
hreftags) for Yahoo Groups:The following statement, for example, returns the textContent of each anchor
atag retrieved by the XPath expression:Source: Extracting HTML - Using YQL and Open Data Tables at YQL Guide