You are here

function recommender_get_app_id in Recommender API 5

Same name and namespace in other branches
  1. 6 recommender.module \recommender_get_app_id()
  2. 6.2 recommender.module \recommender_get_app_id()

Get the application id from the application name.

Parameters

$app_name:

Return value

the id of the application.

7 calls to recommender_get_app_id()
recommender_prediction_classical in ./recommender.module
Classical weight-average algorithm to calculate prediction from the similarity matrix, based on average weight. Limitation: we only do database operation for now. no in-memory operation available until future release. Limitation: we only do average…
recommender_prediction_slopeone in ./recommender.module
This is the implementation of slope-one algorithm, which is supposed to be faster than other algrithms. From the original research paper, the author argues slope-one support incremental update. But this is quite hard to implement. The incremental…
recommender_purge_app in ./recommender.module
Remove the application. Usually used in calling module's hook_uninstall()
recommender_similarity_classical in ./recommender.module
classical collaborative filtering algorithm based on correlation coefficient. could be used in the classical user-user or item-item algorithm see the README file for more details
recommender_similarity_coocurrences in ./recommender.module
Co-ocurrences algorithm that compute similarity among mice based on how many cheese they share.

... See full list

File

./recommender.module, line 504
Providing generic recommender system algorithms.

Code

function recommender_get_app_id($app_name) {
  if (!isset($app_name) || empty($app_name)) {
    return NULL;
  }
  $id = db_result(@db_query("SELECT app_id FROM {recommender_app_map} WHERE app_name='%s'", $app_name));
  if (!isset($id) || empty($id)) {
    db_query("INSERT INTO {recommender_app_map}(app_name) VALUE('%s')", $app_name);
    $id = db_result(db_query("SELECT app_id FROM {recommender_app_map} WHERE app_name='%s'", $app_name));
  }
  return $id;
}