Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • By selecting which communities from those available are used. This is part of the URL as described in the query overview documentation TBD LINK
  • By creating an "input" object at the query top level. This is described in the remainder of this page.

Input specification

Code Block
languagejavascript
titleInput JSON specification
{
	"input": {
		// One of the following:
		"tags": [ string ],
		"typesAndTags": [ { "type": string, "tags": [ string ] } ],
		"sources": [ string ],
		"srcInclude": boolean // (only modifies "sources" field)
	}
}

As can be seen in the above specification, there are three different ways of specifying the source set over which the query runs:

  • If any "tags" are specified then only documents with any (case insensitive/exact) matching tags are included in the query (TBD link to document)
  • "typesAndTags" is similar, except you can restrict a set of tags to documents of a given "type"
  • "sources" is the simplest, specify a set of strings, each of which are compared against documents "sourceKey" fields (taken from sources' "key" fields TBD link to source documentation), and then:
    • if "srcInclude": true (default), then only matching documents are included in the query
    • if "srcInclude": false, then only non-matching documents are included in the query
  • If more than one of the above fields is specified, then the results are ORd together

Source information (such as the source key, and tags and types) can be obtained via the TBD link API call.

Examples

Code Block
languagejavascript
titleExample 1:
{
	"input": {
		"tags": [ "topic:cyber", "topic:defense" ]
	}
}
Code Block
languagejavascript
titleExample 2: as above, but restricted to blogs
{
	"input": {
		"typesAndTags": [ {
			"type": "Blog",
			"tags": [ "topic:cyber", "topic:defense" ]
		}]
	}
}
Code Block
languagejavascript
titleExample 3: search YouTube only
{
	"input": {
		"sources": [ "http.gdata.youtube.com.feeds.base.standardfeeds.most_recent.client=ytapi-youtube-browse.alt=rss" ]
	}
}
Code Block
languagejavascript
titleExample 4: exclude YouTube and Flickr from the search
{
	"input": {
		"sources": [ 
				"http.gdata.youtube.com.feeds.base.standardfeeds.most_recent.client=ytapi-youtube-browse.alt=rss",
				"http.api.flickr.com.services.feeds.photos_public.gne"
		],
		srcInclude: false
	}
}