search

Custom module for Apache Solr Drupal 7 version

  1. <?php
  2.  
  3. /**
  4.  * Implements hook_apachesolr_query_prepare().
  5.  * Used to modify our sorts
  6.  **/
  7. function dug_solr_apachesolr_query_prepare(SolrBaseQuery $query) {
  8.   // Remove sorts from the list
  9.  

resulting sql query

  1. results in this query:
  2.  
  3. SELECT node.nid AS nid, SUM(search_index.score * search_total.count) AS score, 'node' AS field_data_field_roll_type_node_entity_type, 'node' AS field_data_field_regnal_year_n

results after search patch

  1. Following patch from:  http://drupalbin.com/19147
  2.  
  3. AFTER: $search_condition->conditions(): Array
  4. (
  5.     [#conjunction] => AND
  6.     [0] => Array
  7.         (
  8.             [field] => DatabaseCondition

Fix for search filter weirdness - using array_merge instead of +

  1. B4: $condition_conditions: Array
  2. (
  3.     [#conjunction] => AND
  4.     [0] => Array
  5.         (
  6.             [field] => search_dataset.data
  7.             [value] => % james %
  8.             [operator] => LIK

search filter weirdness

  1. B4: $condition_conditions: Array
  2. (
  3.     [#conjunction] => AND
  4.     [0] => Array
  5.         (
  6.             [field] => search_dataset.data
  7.             [value] => % james %
  8.             [operator] => LIK

Ejemplo de tabla con formulario con filtros

  1. /*
  2.  * Implementation of hook_menu().
  3.  */
  4. function admin_menu() {
  5.   $menu['search'] = array(
  6.     'title' => t('Search Database'),
  7.     'description' => t('Search in the report database.'),
  8.     'a

db_rewrite_sql for filtering on CCK type

  1. /**
  2.  * Rewrite search query to search only show results where
  3.  * the "status" CCK field is "approved"
  4.  */

search block default value

  1. function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
  2.   if ($form_id == 'search_block_form') {
  3.     $item = menu_get_item();
  4.     if ($item['map'][0] == 'search') {

Overrise search results page in theme... needs help.

  1. /*override the default search page */
  2. function THEMENAME_search_item($item, $type) {

Adding to search index

  1. <?php
  2.  
  3. function custom_helper_nodeapi($node, $op, $arg = 0) {
  4.   switch ($op) {
  5.     case 'update index':
  6.       if ($node->uid) {
  7.         $user = user_load($node->uid);
Syndicate content