Keyword suggestion
Users will expect the UI search functionality to provide suggestions for keywords as they start entering text before selecting a keyword to search for or just using the entered one. This reduces the time taken to enter the keyword as they only need to enter part of the keyword before the UI suggest the required one.
The MDS builds an index of keywords based on the content metadata. By default, the fields indexed for the suggest API are actor and content title, and the ranking of each keyword is based on the occurrence of the keywords in the content metadata, and the relative importance of the field it is within. For example, if an actor such as Tom Cruise is in more movies or TV shows than Tom Hanks, then when "Tom" is entered, Tom Cruise will be returned with a higher rank. Other fields can be configured to boost the ranking of a keyword if the keyword is found there, however, this type of customisation is project-specific.
The suggest API matches on the beginning of words only, it will not match on the middle or end of words as this would require the searchable index to be too large, and confusing to use in practice.
Basic suggest query for a single string with no filter
In the example below, keywords with 'Joh' in them are searched for.
http://server:port/metadata/solr/[provider]/suggest?q=Joh>
If the appropriate metadata exists, the expected results might be:
- Johnny Depp - Actor
- John Cusack - Actor
- Being John Malkovich - Title
- John Carter - Title
- John Lithgow - Actor
- John Hurt - Actor
- Dear John - Title
- John Travolta - Actor
- John Barrowman - Actor
- John Tucker Must Die - Title
Suggest query for a single string for titles only
In the example below, a filter is used to restrict the previous query to content titles:
http://server:port/metadata/solr/[provider]/suggest?q=Joh&fq=entity:content
Based on the example above, the expected results might be:
- Being John Malkovich - Title
- John Carter - Title
- Dear John - Title
- John Tucker Must Die - Title
Suggest query using two strings
The MDS supports using multiple strings in the query, separated by a space. Again, these must be the beginning of words or full words.
http://server:port/metadata/solr/[provider]/suggest?q=Joh C
Given the first use case, the expected results might now only be:
- John Cusack - Actor
- John Carter - Title
Filtering a suggest query by scope and domain
A suggest query can be filtered by scope and domain. Scope means either live TV data (btv) or On Demand data (vod), domain means the device and region combination used.
To retrieve keyword suggestions for Joh in On Demand for iPad's in Sao Paulo:
http://server:port/metadata/solr/[provider]/suggest?q=Joh C&fq=scope:vod&fq=domain:("ipad|Sao Paulo")
To retrieve keyword suggestions for Joh in Live TV for any device in France:
http://server:port/metadata/solr/[provider]/suggest?q=Joh C&fq=scope:btv&fq=domain:("|France")
Restricting a suggest query to certain nodes
The UI might want to restrict the suggest query to a specific on demand node and its child nodes. This is especially useful in deployments where the on demand catalogue is split into distinct areas such as Movies, TV shows boxsets, Catchup TV and so on. To use this feature, the node representing the root of the tree to which the results are restricted must be specified. For example, to restrict the results to only the contents of the Movies node (and all its sub-nodes), and the Movies node id is "Movies_12345", the following query would be used:
http://server:port/metadata/solr/[provider]/suggest?q=Joh C&fq=scope:vod&fq=domain:("STB|UK")&descendantsOf:Movies_12345