Skip to main content

Posts

Showing posts from January, 2014

Drupal 7 apache solr custom query [apache_solr_drupal_query()]

/**  * custom SOLR search function.  */ function search_SOLR($keyword) {   $solr = apachesolr_get_solr();   $query = apachesolr_drupal_query("custom", array('q' => $keyword));   $query->addParam('rows', '1000'); // How many rows of result to display default it is 10.   $query->addFilter('bundle', (event OR city OR company));   $query->removeFilter('bundle');   $query->addParam('fq', "bundle:(event OR city OR company)");   $resp = $query->search();    // Only search in title   $query->replaceParam('qf', 'label');   $resp_ = $query->search(); }

Drupal 7 hook_menu with tab

The following code is the example of hook_menu with tabs /**  * Implements hook_menu().  */ function eventstab_menu() {   $items['my-events'] = array(     'title' => 'My events',     'menu_name' => 'main-menu',     'type' => MENU_CALLBACK,     'page callback' => 'drupal_get_form',     'page arguments' => array('my_events'),     'access arguments' => array('access my events page'),   );   $items['my-events/technology'] = array(     'title' => 'Technology',     'type' => MENU_DEFAULT_LOCAL_TASK,     'page callback' => 'drupal_get_form',     'page arguments' => array('my_events_technology'),     'weight' => -10   );   $items['my-events/business'] = array(     'title' => 'Business',     'type' => MENU_LOCAL_TASK,     'page callb