Changeset 6141

Show
Ignore:
Timestamp:
06/02/07 21:57:06 (1 year ago)
Author:
tarjei
Message:

#32
* Backport solr implementation to 2.8
* remove some logging
* some minor other changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.admin.folder/folder_management.php

    r5715 r6141  
    217217             
    218218            // Skip components beginning with midcom or midgard 
    219             if (ereg('^(midcom|midgard)\.', $manifest->name)) 
     219            if (   ereg('^(midcom|midgard)\.', $manifest->name) 
     220                && $manifest->name != 'midcom.helper.search') 
    220221            { 
    221222                continue; 
     
    237238                $description = ''; 
    238239            } 
    239              
     240 
    240241            $components[$manifest->name] = array 
    241242            ( 
    242                 'name' => $manifest->get_name_translated(), 
     243                'name'        => $manifest->get_name_translated(), 
    243244                'description' => $description, 
     245                'state'       => $manifest->state, 
     246                'version'     => $manifest->version, 
    244247            ); 
    245248        } 
  • branches/MidCOM_2_8/midcom.admin.folder/static/folder.css

    r5715 r6141  
    1818div.midcom_admin_content_componentlist dl 
    1919{ 
    20     height: 250px; 
     20    height: 300px; 
    2121    overflow-x: auto; 
    2222    border: 1px #f0f0f0 solid; 
    2323    padding: 6px; 
    2424    margin-top: 0px; 
     25    font-size: smaller; 
    2526} 
    2627 
     
    2829{ 
    2930    margin-bottom: 6px; 
     31    margin-left: 22px; 
     32    margin-top: 2px; 
     33} 
     34 
     35div.midcom_admin_content_componentlist dl dt.devel, 
     36div.midcom_admin_content_componentlist dl dd.devel, 
     37div.midcom_admin_content_componentlist dl dt.alpha, 
     38div.midcom_admin_content_componentlist dl dd.alpha 
     39 
     40{ 
     41    color: #c0c0c0; 
    3042} 
    3143 
  • branches/MidCOM_2_8/midcom.admin.folder/style/midcom-admin-show-component-list.php

    r5074 r6141  
    1313            } 
    1414            ?> 
    15             <dt><label><input type="radio" name="f_type" value="&(path:h);"&(selected:h); /><strong>&(information['name']:h);</strong> (&(path:h);)</label></dt> 
     15            <dt class="&(information['state']:h);"><label><input type="radio" name="f_type" value="&(path:h);"&(selected:h); /><strong>&(information['name']:h);</strong> <span class="component">(&(path:h); <span class="version">&(information['version']:h);</span>)</span></label></dt> 
    1616            <?php 
    1717            if (array_key_exists('description', $information)) 
    1818            { 
    1919                ?> 
    20                 <dd>&(information['description']:h);</dd> 
     20                <dd class="&(information['state']:h);">&(information['description']:h);</dd> 
    2121                <?php 
    2222            } 
  • branches/MidCOM_2_8/midcom.admin.settings/locale/default.en.txt

    r4604 r6141  
    205205 
    206206---STRING midcom_root_topic_guid 
    207 Root folder 
     207Root topic 
    208208---STRINGEND 
    209209 
  • branches/MidCOM_2_8/midcom.core/midcom/core/manifest.php

    r5535 r6141  
    233233 
    234234    /** 
    235      * Old version number of the components, currently specified as integer. Not really 
    236      * used within the system, but you may (actually should) use it for your own versioning. 
    237      * 
    238      * Note, that this is now a string (was formerly an int) since the PEAR transition. This 
    239      * change should not affect anything as I do not know any component actually making use 
    240      * of this member yet. You should now use version_compare in context with this member 
    241      * always. 
     235     * Version number of the components. 
    242236     * 
    243237     * @var string 
    244238     */ 
    245     var $version = 0; 
     239    var $version = '0.0.1'; 
     240 
     241    /** 
     242     * State of the components. 
     243     * 
     244     * @var string 
     245     */ 
     246    var $state = 'devel'; 
    246247 
    247248    /** 
     
    325326            $this->version = $this->_raw_data['version']; 
    326327        } 
     328        if (array_key_exists('state', $this->_raw_data)) 
     329        { 
     330            $this->state = $this->_raw_data['state']; 
     331        } 
    327332        if (array_key_exists('privileges', $this->_raw_data)) 
    328333        { 
  • branches/MidCOM_2_8/midcom.core/midcom/exec/reindex.php

    r5235 r6141  
    128128        // returned with failure 
    129129        echo "failure.\n   Background processing failed, error: {$http_client->error}\n"; 
     130        echo "Url: " . $reindex_topic_uri . "?" . join("=", $post_variables); 
    130131        $body = $http_client->_client->getResponseBody(); 
    131132        if (!empty($body)) 
     
    139140        // Does not end with 'Reindex complete for node...' 
    140141        echo "failure.\n   Background reindex returned unexpected data:\n---\n{$response}\n---\n\n"; 
     142        echo "Url: " . $reindex_topic_uri . "?" . join("=", $post_variables); 
    141143    } 
    142144    else 
  • branches/MidCOM_2_8/midcom.core/midcom/helper/hostconfig.php

    r5221 r6141  
    179179         
    180180        $codeinit .= "\nif(!defined('MIDCOM_ROOT')) {"; 
    181         $codeinit .= "\n    define('MIDCOM_ROOT','midcom/lib');"; 
     181         
     182        $codeinit .= "\n    define('MIDCOM_ROOT','".MIDCOM_ROOT."');"; 
    182183        $codeinit .= "\n}\n"; 
    183184         
  • branches/MidCOM_2_8/midcom.core/midcom/services/cache/backend/flatfile.php

    r5525 r6141  
    5353        } 
    5454         
    55         debug_add("Flatfile Cache backend '{$this->_name}' initialized to directory: {$this->_dirname}"); 
     55        //debug_add("Flatfile Cache backend '{$this->_name}' initialized to directory: {$this->_dirname}"); 
    5656    } 
    5757 
  • branches/MidCOM_2_8/midcom.core/midcom/services/dbclassloader.php

    r5852 r6141  
    277277        if ($cache_hit) 
    278278        { 
    279             debug_add("We had a cache hit for {$component}/{$filename}."); 
     279            //debug_add("We had a cache hit for {$component}/{$filename}."); 
    280280            debug_pop(); 
    281281            return true; 
  • branches/MidCOM_2_8/midcom.core/midcom/services/indexer.php

    r3766 r6141  
    232232            return true; 
    233233        } 
    234  
    235234        return $this->_backend->delete_all(); 
    236235    } 
     
    245244     * The query syntax is also dependant on the backend. Refer to its documentation 
    246245     * how queries should be built. 
    247      * 
    248      * Each result node is looked up in NAP/Metadata to verify its visibility. 
    249246     * 
    250247     * @param string $query The query, which must suite the backends query syntax. It is assumed to be in the site charset. 
     
    293290            } 
    294291 
     292            // this checks acls! 
    295293            if ($document->is_a('midcom')) 
    296294            { 
     
    304302                } 
    305303            } 
    306  
    307             // For all midcom doucments, check the metadata visibility state given by the source object. 
    308             // Do this only if MidCOM is configured to do so 
    309             if (   $document->is_a('midcom') 
    310                 && (   $midcom_config['show_hidden_objects'] 
    311                     || $midcom_config['show_unapproved_objects'])) 
    312             { 
    313                 $metadata =& midcom_helper_metadata::retrieve($document->source); 
    314  
    315                 if (   $metadata 
    316                     && ! $metadata->is_object_visible_onsite()) 
    317                 { 
    318                     debug_add("Skipping the document {$document->title}, the metadata of the source document {$document->source} indicate no visibility."); 
    319                     continue; 
    320                 } 
    321  
    322                 // Drop the reference again. 
    323                 unset($metadata); 
    324             } 
    325  
    326             // Check for additional security checks by the component or a custom callback 
    327             $component_loader =& $_MIDCOM->get_component_loader(); 
    328             $security = explode(':', $document->security, 2); 
    329             switch ($security[0]) 
    330             { 
    331                 case 'component': 
    332                     // Component security, get the interface base class, if it exists, and 
    333                     // execute the corresponding handler. 
    334                     debug_add('Doing additional component-level security check'); 
    335                     $interface =& $component_loader->get_interface_class($document->component); 
    336                     if (   $interface 
    337                         && $topic 
    338                         && ! $interface->check_document_permissions($document, $topic)) 
    339                     { 
    340                         debug_add('Skipping the document, the callee returned false.'); 
    341                         continue 2; 
    342                     } 
    343                     break; 
    344  
    345                 case 'function': 
    346                     // Execute a custom callback to ascertain visbility. 
    347                     debug_add("We are in function security mode, executing the callback {$security[1]}."); 
    348                     if (! $security[1]($document, $topic)) 
    349                     { 
    350                         debug_add('Skipping the document, the callee returned false.'); 
    351                         continue 2; 
    352                     } 
    353                     break; 
    354  
    355                 case 'class': 
    356                     die ('The class security callback is disabled, it is broken from the beginning.'); 
    357                     // TODO: Fix this. 
    358  
    359                     // Execute a custom callback to ascertain visbility. 
    360                     debug_add("We are in function security mode, executing the callback {$security[1]}."); 
    361                     $class = $security[1]; 
    362                     $instance =& $class->get_instance(); 
    363                     if (! $instance->check_document_permissions($document, $topic)) 
    364                     { 
    365                         debug_add('Skipping the document, the callee returned false.'); 
    366                         continue 2; 
    367                     } 
    368                     break; 
    369             } 
    370  
    371304            $result[] = $document; 
    372305        } 
  • branches/MidCOM_2_8/midcom.core/midcom/services/indexer/document.php

    r3766 r6141  
    347347    { 
    348348        // This is always UTF-8 conformant. 
    349         $this->_add_field($name, 'date', strftime('%Y-%m-%dT%H:%M:%S', $timestamp), true); 
     349        $this->_add_field($name, 'date', strftime('%Y-%m-%dT%H:%M:%SZ', $timestamp), true); 
    350350    } 
    351351 
  • branches/MidCOM_2_8/midcom.helper.search/config/manifest.inc

    r5819 r6141  
    1  
    21  'name' => 'midcom.helper.search', 
    3   'version' => '1.0.3beta1', 
     2  'version' => '1.0.4beta1', 
    43  'state' => 'beta', 
    54  'purecode' => false, 
     
    2322        'active' => 'no', 
    2423      ), 
     24      'tarjei' =>  
     25      array ( 
     26        'name' => 'Tarjei Huse', 
     27        'email' => 'tarjei@nu.no', 
     28        'role' => 'lead', 
     29        'active' => 'yes', 
     30      ), 
     31  
    2532    ), 
    2633    'dependencies' =>  
     
    2936      array ( 
    3037      ), 
     38      'http_request' => 
     39         array ( 
     40            'channel' => 'pear.php.net', 
     41        ), 
    3142    ), 
    3243  ), 
  • branches/MidCOM_2_8/midcom.helper.search/style/advanced_form.php

    r5048 r6141  
    11<?php 
    2 //$data =& $_MIDCOM->get_custom_context_data('request_data'); 
     2$data =& $_MIDCOM->get_custom_context_data('request_data'); 
    33$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX); 
    44 
  • branches/MidCOM_2_8/midcom.helper.search/style/search_form.php

    r5048 r6141  
    1 <?php 
    2 //$data =& $_MIDCOM->get_custom_context_data('request_data'); 
    3 ?> 
    41<h1><?php echo $data['topic']->extra;?></h1> 
    52 
  • branches/MidCOM_2_8/midcom.helper.search/viewer.php

    r4120 r6141  
    5858            case 'advanced': 
    5959                $data['query'] = (array_key_exists('query', $_REQUEST) ? $_REQUEST['query'] : ''); 
    60                 $data['topic'] = (array_key_exists('topic', $_REQUEST) ? $_REQUEST['topic'] : ''); 
     60                //$data['topic'] = (array_key_exists('topic', $_REQUEST) ? $_REQUEST['topic'] : ''); 
    6161                $data['component'] = (array_key_exists('component', $_REQUEST) ? $_REQUEST['component'] : ''); 
    6262                $data['lastmodified'] = (array_key_exists('lastmodified', $_REQUEST) ? ((integer) $_REQUEST['lastmodified']) : 0); 
     
    105105                                if (   count(explode(' ', $data['query'])) == 1 
    106106                                    && !strstr($data['query'], '*')) 
     107                                { 
     108                                    // Single search term, append * 
     109                    if ($GLOBALS['midcom_config']['indexer_backend'] != 'solr')  
     110                    { 
     111                                        $data['query'] .= '*'; 
     112                    } 
     113                                } 
     114                                 
     115                                $result = $indexer->query($data['query']); 
     116                break; 
     117             
     118            case 'advanced': 
     119                $data['query'] = trim($_REQUEST['query']); 
     120                 
     121                                if (   count(explode(' ', $data['query'])) == 1 
     122                                    && !strstr($data['query'], '*') && $GLOBALS['midcom_config']['indexer_backend'] != 'solr' ) 
    107123                                { 
    108124                                    // Single search term, append * 
     
    110126                                } 
    111127                                 
    112                                 $result = $indexer->query($data['query']); 
    113                 break; 
    114              
    115             case 'advanced': 
    116                 $data['query'] = trim($_REQUEST['query']); 
    117                  
    118                                 if (   count(explode(' ', $data['query'])) == 1 
    119                                     && !strstr($data['query'], '*')) 
    120                                 { 
    121                                     // Single search term, append * 
    122                                     $data['query'] .= '*'; 
    123                                 } 
    124                                  
    125                                 $data['topic'] = trim($_REQUEST['topic']); 
    126                 // $data['topic2'] = trim($_REQUEST['topic2']); 
     128                                $data['request_topic'] = trim($_REQUEST['topic']); 
    127129                $data['component'] = trim($_REQUEST['component']); 
    128130                $data['lastmodified'] = (integer) trim($_REQUEST['lastmodified']); 
     
    136138                } 
    137139                 
    138                 if ($data['query'] != ''
    139                 { 
    140                     $final_query = "({$data['query']})"; 
     140                if ($data['query'] != ''
     141                { 
     142                    $final_query = ( $GLOBALS['midcom_config']['indexer_backend'] == 'solr' ) ? $data['query'] : "({$data['query']})"; 
    141143                } 
    142144                else 
     
    145147                } 
    146148                 
    147                 if ($data['topic'] != '') 
     149                if ($data['request_topic'] != '') 
    148150                { 
    149151                    if ($final_query != '') 
     
    151153                        $final_query .= ' AND '; 
    152154                    } 
    153                     $final_query .= "__TOPIC_URL:\"{$data['topic']}*\""; 
    154                 } 
    155                 /* 
    156                 *This if makes able to search more than one topics 
    157                 *You need to put in to the input value in the search form topics separated by ; 
    158                 *no spaces 
    159                 * / 
    160                 if ($data['topic2'] != '') 
    161                 { 
    162                         if ($final_query != '') 
    163                     { 
    164                         $final_query .= ' AND '; 
    165                     } 
    166                         $topic_arrays = explode(";" ,$data['topic2']); 
    167                         $final_tmp_query = ""; 
    168                          
    169                         foreach ($topic_arrays as $topic_tmp) 
    170                         { 
    171                         if ($final_tmp_query != '') 
    172                             { 
    173                             $final_tmp_query .= ' OR '; 
    174                             } 
    175                             else 
    176                             { 
    177                                     $final_tmp_query .= " ( "; 
    178                             } 
    179                         $final_tmp_query .= "__TOPIC_URL:\"{$topic_tmp}*\""; 
    180                         } 
    181                         $final_tmp_query .= " )"; 
    182                          
    183                          
    184                     $final_query .= $final_tmp_query; 
    185                 } 
    186                 */ 
    187                  
     155                    $final_query .= "__TOPIC_URL:\"{$data['request_topic']}*\""; 
     156                } 
     157                
    188158                if ($data['component'] != '') 
    189159                { 
  • branches/MidCOM_2_8/midgard.webdav.styles/viewer.php

    r4767 r6141  
    127127        $document->topic_guid = $topic->guid; 
    128128        $document->topic_url = $node[MIDCOM_NAV_FULLURL]; 
     129        $document->component = $topic->component; 
    129130        $document->author = $author->name; 
    130131        $document->created = $dm->storage->object->created; 
  • branches/MidCOM_2_8/net.nehmer.blog/viewer.php

    r5856 r6141  
    450450        $document = $indexer->new_document($dm); 
    451451        $document->topic_guid = $topic->guid; 
     452        $document->component = $topic->component; 
    452453        $document->topic_url = $node[MIDCOM_NAV_FULLURL]; 
    453454        $document->author = $author->name; 
  • branches/MidCOM_2_8/net.nehmer.static/viewer.php

    r5797 r6141  
    194194        $document->created = $dm->storage->object->created; 
    195195        $document->edited = $dm->storage->object->revised; 
     196        $document->component = $topic->component; 
    196197        $indexer->index($document); 
    197198    } 
  • branches/MidCOM_2_8/net.nemein.calendar/viewer.php

    r5499 r6141  
    357357        $document->topic_guid = $topic->guid; 
    358358        $document->topic_url = $node[MIDCOM_NAV_FULLURL]; 
     359        $document->component = $topic->component; 
    359360        if (!empty($author)) 
    360361        { 
  • branches/MidCOM_2_8/net.nemein.discussion/viewer.php

    r5750 r6141  
    214214        $document->created = $dm->storage->object->created; 
    215215        $document->edited = $dm->storage->object->revised; 
     216        $document->component = $topic->component; 
    216217        $indexer->index($document); 
    217218    }     
  • branches/MidCOM_2_8/net.nemein.netmon/viewer.php

    r6072 r6141  
    154154        $document->created = $dm->storage->object->created; 
    155155        $document->edited = $dm->storage->object->revised; 
     156        $document->component = $topic->component; 
    156157        $indexer->index($document); 
    157158    } 
  • branches/MidCOM_2_8/net.nemein.organizations/viewer.php

    r4894 r6141  
    219219        $document->created = $dm->storage->object->metadata->created; 
    220220        $document->edited = $dm->storage->object->metadata->revised; 
     221        $document->component = $topic->component; 
    221222        $indexer->index($document); 
    222223    } 
  • branches/MidCOM_2_8/net.nemein.personnel/viewer.php

    r6003 r6141  
    350350        $document->created = $dm->storage->object->metadata->created; 
    351351        $document->edited = $dm->storage->object->metadata->revised; 
     352        $document->component = $topic->component; 
    352353        $indexer->index($document); 
    353354    } 
  • branches/MidCOM_2_8/net.nemein.quickpoll/viewer.php

    r5702 r6141  
    142142        $document->created = $dm->storage->object->created; 
    143143        $document->edited = $dm->storage->object->revised; 
     144        $document->component = $topic->component; 
    144145        $indexer->index($document); 
    145146    } 
  • branches/MidCOM_2_8/net.nemein.registrations/event.php

    r6057 r6141  
    944944        $document->created = $dm->storage->object->created; 
    945945        $document->edited = $dm->storage->object->revised; 
     946        $document->component = $topic->component; 
    946947        $indexer->index($document); 
    947948    } 
  • branches/MidCOM_2_8/net.nemein.updatenotification/viewer.php

    r5749 r6141  
    8686        $document->topic_guid = $topic->guid; 
    8787        $document->topic_url = $node[MIDCOM_NAV_FULLURL]; 
     88        $document->component = $topic->component; 
    8889        $document->author = $author->name; 
    8990        $document->created = $dm->storage->object->created; 
  • branches/MidCOM_2_8/net.nemein.wiki/viewer.php

    r4610 r6141  
    271271        $document->created = $dm->storage->object->created; 
    272272        $document->edited = $dm->storage->object->revised; 
     273        $document->component = $topic->component; 
    273274        $indexer->index($document); 
    274275    }   
  • branches/MidCOM_2_8/no.odindata.quickform2/viewer.php

    r4826 r6141  
    9696        $document->author = $author->name; 
    9797        $document->created = $dm->storage->object->created; 
     98        $document->component = $topic->component; 
    9899        $document->edited = $dm->storage->object->revised; 
    99100        $indexer->index($document); 
  • branches/MidCOM_2_8/org.openpsa.products/viewer.php

    r6067 r6141  
    218218        $document = $indexer->new_document($dm); 
    219219        $document->topic_guid = $topic->guid; 
     220        $document->component = $topic->component; 
    220221        $document->topic_url = $node[MIDCOM_NAV_FULLURL]; 
    221222        $document->author = $author->name; 
  • branches/MidCOM_2_8/org.routamc.photostream/viewer.php

    r5387 r6141  
    349349        $document = $indexer->new_document($dm); 
    350350        $document->topic_guid = $topic->guid; 
     351        $document->component = $topic->component; 
    351352        $document->topic_url = $node[MIDCOM_NAV_FULLURL]; 
    352353        $document->author = $author->name; 
  • branches/MidCOM_2_8/scaffold/viewer.php

    r4381 r6141  
    7979        $document = $indexer->new_document($dm); 
    8080        $document->topic_guid = $topic->guid; 
     81        $document->component = $topic->component; 
    8182        $document->topic_url = $node[MIDCOM_NAV_FULLURL]; 
    8283        $document->author = $author->name;