Knowledge - Query - Input Options

Overview

There are two ways that a user can control the sources over which the query is applied:

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

In this section:

Input Specification

Input 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
  • "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), 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 "person/get" API call.

Examples

Example 1:
{
	"input": {
		"tags": [ "topic:cyber", "topic:defense" ]
	}
}
Example 2: as above, but restricted to blogs
{
	"input": {
		"typesAndTags": [ {
			"type": "Blog",
			"tags": [ "topic:cyber", "topic:defense" ]
		}]
	}
}
Example 3: search YouTube only
{
	"input": {
		"sources": [ "http.gdata.youtube.com.feeds.base.standardfeeds.most_recent.client=ytapi-youtube-browse.alt=rss" ]
	}
}
Example 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
	}
}