OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

oracle.adfinternal.view.js.data.inputSearch
Class AdfInputSearchScoreUtils

Warning:

org.ecmascript.object.Object
   |
   +--oracle.adf.view.js.base.AdfObject
         |
         +--oracle.adfinternal.view.js.data.inputSearch.AdfInputSearchScoreUtils

public class AdfInputSearchScoreUtils
extends AdfObject
Utils class for score management of af:suggestionsSection backed list. At preset, this provides helper methods to score the suggestions based on frecency. Frecency is frequency + recency, inspired by Firefox url bar's link scoring logic. The logic here identifies the selected suggestion item as a) A new item b) An item that is previously selected in the same user session c) An item selected in previous user session d) An item selected in an earlier user session Based on this identification, its score is updated by a different margin giving preference to its frequency and recency. The decay of score of previously selected suggestion items on selection of a new item is also based on similar logic. See updateScores method for the implementation.


Field Summary

private static Object
_DECAY_SCORE_MAP
private static Object
_MAX_SCORE
private static Object
_NEW_ITEM_SCORE
private static Object
_SCORE_INCREMENTOR_MAP
private static Object
_STATE_OLD_SESSION
private static Object
_STATE_PREVIOUS_SESSION
private static Object
_STATE_SAME_SESSION

Fields inherited from oracle.adf.view.js.base.AdfObject

constructor, superclass

Fields inherited from org.ecmascript.object.Object

prototype

Constructor Summary

public
AdfInputSearchScoreUtils()
Utils class for score management of af:suggestionsSection backed list.

Method Summary

private static Object
_decrementScores(Object scoreMap, Object sessionTimeStamps)
public static Object
getMinScoredSuggestionKey(Object scoreMap)
Returns the key of the suggestion item with minimum score
private static Object
_getSessionState(Object itemTimeStamp, Object sessionTimeStamps)
Returns if the passed time-stamps is part of current user session, previous user session, or an older previous session.
private static Object
_incrementScore(Object currentItemScore, Object sessionTimeStamps)
protected static Object
InitClass()
public static Object
sortPerScore(Object suggestionsList, Object scoreMap)
Sorts the suggestions in the suggestionsList array based on the scores present in scoreMap
public static Object
updateScores(String storageKey, Object preferredSuggestions, Number|String currentValue)
Updates the scores on selection of new item
private static Object
_updateSessionState(String storageKey, Object preferredSuggestions)
Popuplates the sessionStorage with a) time-stamp of previous session when the current localStorage item was accessed b) current time and also caches the current time on the localStorage (via preferredSuggestions object) which will be helpful in determining the previous session timestamp in the next user session A combination of these two time-stamps will be helpful to determine if the suggestion item was earlier selected within the same user session, previous user session, or in an earlier user session.

Methods inherited from oracle.adf.view.js.base.AdfObject

adopt, clone, createCallback, createInitializedObject, createSubclass, ensureClassInitialization, equals, exportPrototypeSymbol, getClass, GetLazyArrayProperty, GetLazyMapProperty, getTypeName, Init, toDebugString, toString

Field Detail


_DECAY_SCORE_MAP

private static Object _DECAY_SCORE_MAP

_MAX_SCORE

private static Object _MAX_SCORE

_NEW_ITEM_SCORE

private static Object _NEW_ITEM_SCORE

_SCORE_INCREMENTOR_MAP

private static Object _SCORE_INCREMENTOR_MAP

_STATE_OLD_SESSION

private static Object _STATE_OLD_SESSION

_STATE_PREVIOUS_SESSION

private static Object _STATE_PREVIOUS_SESSION

_STATE_SAME_SESSION

private static Object _STATE_SAME_SESSION

Constructor Detail


AdfInputSearchScoreUtils

public AdfInputSearchScoreUtils()

Utils class for score management of af:suggestionsSection backed list. At preset, this provides helper methods to score the suggestions based on frecency. Frecency is frequency + recency, inspired by Firefox url bar's link scoring logic. The logic here identifies the selected suggestion item as a) A new item b) An item that is previously selected in the same user session c) An item selected in previous user session d) An item selected in an earlier user session Based on this identification, its score is updated by a different margin giving preference to its frequency and recency. The decay of score of previously selected suggestion items on selection of a new item is also based on similar logic. See updateScores method for the implementation.

Method Detail


_decrementScores

private static Object _decrementScores(Object scoreMap,
                                       Object sessionTimeStamps)

Parameters:
scoreMap  
sessionTimeStamps  
Return:
Object

getMinScoredSuggestionKey

public static Object getMinScoredSuggestionKey(Object scoreMap)

Returns the key of the suggestion item with minimum score

Parameters:
scoreMap  
Return:
Object

_getSessionState

private static Object _getSessionState(Object itemTimeStamp,
                                       Object sessionTimeStamps)

Returns if the passed time-stamps is part of current user session, previous user session, or an older previous session.

Parameters:
itemTimeStamp  
sessionTimeStamps  
Return:
Object

_incrementScore

private static Object _incrementScore(Object currentItemScore,
                                      Object sessionTimeStamps)

Parameters:
currentItemScore  
sessionTimeStamps  
Return:
Object

InitClass

protected static Object InitClass()

Return:
Object

sortPerScore

public static Object sortPerScore(Object suggestionsList,
                                  Object scoreMap)

Sorts the suggestions in the suggestionsList array based on the scores present in scoreMap

Parameters:
suggestionsList  
scoreMap  
Return:
Object

updateScores

public static Object updateScores(String storageKey,
                                  Object preferredSuggestions,
                                  Number|String currentValue)

Updates the scores on selection of new item

Parameters:
storageKey - The key of the localStorage item
preferredSuggestions - The parsed preferredSuggestions object associated with storageKey
currentValue - the newly selected suggestion item's key
Return:
Object

_updateSessionState

private static Object _updateSessionState(String storageKey,
                                          Object preferredSuggestions)

Popuplates the sessionStorage with a) time-stamp of previous session when the current localStorage item was accessed b) current time and also caches the current time on the localStorage (via preferredSuggestions object) which will be helpful in determining the previous session timestamp in the next user session A combination of these two time-stamps will be helpful to determine if the suggestion item was earlier selected within the same user session, previous user session, or in an earlier user session.

Parameters:
storageKey - The key of sessionStorage
preferredSuggestions - The parsed preferredSuggestions object. Any changes to this object will be persisted in the localStorage
Return:
Object

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.