You are here

function apachesolr_mlt_load_block in Apache Solr Search 5

Same name and namespace in other branches
  1. 5.2 apachesolr.module \apachesolr_mlt_load_block()
  2. 6 apachesolr.module \apachesolr_mlt_load_block()
  3. 6.2 apachesolr.module \apachesolr_mlt_load_block()

function apachesolr_mlt_load_block() A loader function for the apachesolr more like this module. If the function is passed a proper block id, the function will return the settings for the moreLikeThis request. If the block id is invalid the function returns an empty array.

Parameters

int $block_id the id of the block you wish to load:

Return value

array Either the array of settings to perform the moreLikeThis request or an empty array if the block id is invalid.

3 calls to apachesolr_mlt_load_block()
apachesolr_mlt_block_form in contrib/apachesolr_mlt/apachesolr_mlt.module
function apachesolr_mlt_block_form() Allows users to create and edit moreLikeThis Blocks.
apachesolr_mlt_delete_block_form in contrib/apachesolr_mlt/apachesolr_mlt.module
apachesolr_mlt_suggestions in contrib/apachesolr_mlt/apachesolr_mlt.module
function apachesolr_mlt_suggestions() This function loads a the parameters for each moreLikeThis query, performs the query, and returns a list of linked node titles.

File

contrib/apachesolr_mlt/apachesolr_mlt.module, line 293

Code

function apachesolr_mlt_load_block($block_id = 0) {
  if (is_numeric($block_id)) {
    $query_results = db_result(db_query('SELECT data FROM {apachesolr_mlt} WHERE id = %d', $block_id));
    if (strlen($query_results)) {
      return unserialize($query_results);
    }
  }
  else {
    return array();
  }
}