My favorites | English | Sign in

Google Desktop APIs (Labs)

google.pers.ranking

 SUMMARY     DETAIL

Static Class google.pers.ranking

The google.pers.ranking namespace contains methods for using the ranking engine. Methods in this namespace let you create rankable items, change how an attribute affects ranking, and make requests to sort items.

See also: Personalization API Developer Guide, RankableItem

Method Summary

<static>  object createProfile(applicationName)
Creates and returns a gadget-specific profile if it doesn't already exist; otherwise opens and returns the profile.
<static>  RankableItem createRankableItem()
Creates and returns an object representing an item that can be ranked.
<static> modifyAttributeAlgorithm(name, algorithm)
Changes the algorithm to use for calculating the score of a particular attribute.
<static> modifyAttributeWeight(name, weight)
Changes the weight for the specified ranking attribute.
<static>  Array<RankableItem>, contentItems rankAllItems(profile, items, maxItemsPerSource)
Sorts all the rankable items associated with the specified profile.
<static>  Array<RankableItem>, contentItems rankItemsForDataSource(profile, items, dataSourceId)
Sorts only the items that are associated with the specified data source.
 

Method Detail

createProfile

<static> object createProfile(applicationName)
    Creates and returns a gadget-specific profile if it doesn't already exist; otherwise opens and returns the profile. Use this profile to identify your gadget whenever you use the ranking engine. Example:
    var profile = google.pers.ranking.createProfile("MyGadget");
    
    Parameters:
      string applicationName - The name of the application that the profile represents; used to identify the profile
    Returns:
      object The profile

createRankableItem

<static> RankableItem createRankableItem()
    Creates and returns an object representing an item that can be ranked. Example:
    var rankItem = google.pers.ranking.createRankableItem();
    

modifyAttributeAlgorithm

<static> modifyAttributeAlgorithm(name, algorithm)
    Changes the algorithm to use for calculating the score of a particular attribute. You should specify both proportionality and steepness. For example:
    google.pers.ranking.modifyAttributeAlgorithm(
        "NumberOfClicks",
        contentRankingAlgorithm.DirectlyProportional | contentRankingAlgorithm.MostSteep);
    

    See also: Changing an attribute's algorithm

    Parameters:
      string name - The name of the attribute, such as "LastClickedTime"

modifyAttributeWeight

<static> modifyAttributeWeight(name, weight)
    Changes the weight for the specified ranking attribute. By default, every attribute's weight is 1.0.

    The higher an attribute's weight is (compared to other attributes' weights) the more that attribute's score affects the ranking. To ignore an attribute, set its weight to 0.0.

    See also: Changing an attribute's weight

    Parameters:
      string name - The name of the attribute, such as "LastClickedTime"
      float weight - The new weight of the attribute

rankAllItems

<static> Array<RankableItem>, contentItems rankAllItems(profile, items, maxItemsPerSource)
    Parameters:
      object profile - An object (returned by createProfile()) that identifies this gadget
      Array<RankableItem>, contentItems items - The items to be sorted
      integer maxItemsPerSource - The maximum number of items to display per data source
    Returns:
      Array<RankableItem>, contentItems A newly sorted array of items

rankItemsForDataSource

<static> Array<RankableItem>, contentItems rankItemsForDataSource(profile, items, dataSourceId)
    Parameters:
      object profile - An object (returned by createProfile()) that identifies this gadget
      Array<RankableItem>, contentItems items - An array of items
      integer dataSourceId - The data source associated with all the items to be sorted
    Returns:
      Array<RankableItem>, contentItems A newly sorted array of items

Back to top

Documentation generated by JsDoc Toolkit 1.3.3