Changeset 13033

Show
Ignore:
Timestamp:
10/23/07 20:04:38 (1 year ago)
Author:
rambo
Message:

way for the advanced form to pass totally custom query terms, version bump

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.helper.search/config/manifest.inc

    r12981 r13033  
    11  'name' => 'midcom.helper.search', 
    2   'version' => '1.0.4beta2', 
     2  'version' => '1.0.4beta3', 
    33  'state' => 'beta', 
    44  'purecode' => false, 
  • branches/MidCOM_2_8/midcom.helper.search/viewer.php

    r12971 r13033  
    9595            $final_query .= ' AND (__LANG:"' . $_MIDCOM->i18n->get_current_language() . '" OR __LANG:"")'; 
    9696        } 
     97    } 
     98 
     99    /** 
     100     * Expand arrays of custom rules to end of query 
     101     * 
     102     * @param $final_query reference to the query string to be passed on to the indexer. 
     103     * @param $terms array or string to append 
     104     */ 
     105    function append_terms_recursive(&$final_query, $terms) 
     106    { 
     107        if (is_array($terms)) 
     108        { 
     109            foreach ($terms as $term) 
     110            { 
     111                $this->append_terms_recursive($final_query, $term); 
     112            } 
     113            return; 
     114        } 
     115        if (is_string($terms)) 
     116        { 
     117            $final_query .= " {$terms}"; 
     118            return; 
     119        } 
     120        debug_push_class(__CLASS__, __FUNCTION__); 
     121        debug_add('Don\'t know how to handle terms of type: ' . gettype($terms), MIDCOM_LOG_ERROR); 
     122        debug_print_r('$terms', $terms); 
     123        debug_pop(); 
     124        return; 
    97125    } 
    98126 
     
    201229                    } 
    202230                    $final_query .= "__COMPONENT:{$data['component']}"; 
     231                } 
     232 
     233                // Way to add very custom terms 
     234                if (isset($_REQUEST['append_terms'])) 
     235                { 
     236                    $this->append_terms_recursive($final_query, $_REQUEST['append_terms']); 
    203237                } 
    204238