Changeset 6137
- Timestamp:
- 06/02/07 20:49:10 (1 year ago)
- Files:
-
- trunk/midcom/midcom.core/midcom/services/indexer.php (modified) (4 diffs)
- trunk/midcom/midcom.core/midcom/services/indexer/backend/solr.php (added)
- trunk/midcom/midcom.core/midcom/services/indexer/document.php (modified) (1 diff)
- trunk/midcom/midcom.helper.search/config/manifest.inc (modified) (3 diffs)
- trunk/midcom/midcom.helper.search/style/advanced_form.php (modified) (1 diff)
- trunk/midcom/midcom.helper.search/style/search_form.php (modified) (1 diff)
- trunk/midcom/midcom.helper.search/viewer.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom/services/indexer.php
r3766 r6137 232 232 return true; 233 233 } 234 235 234 return $this->_backend->delete_all(); 236 235 } … … 245 244 * The query syntax is also dependant on the backend. Refer to its documentation 246 245 * how queries should be built. 247 *248 * Each result node is looked up in NAP/Metadata to verify its visibility.249 246 * 250 247 * @param string $query The query, which must suite the backends query syntax. It is assumed to be in the site charset. … … 293 290 } 294 291 292 // this checks acls! 295 293 if ($document->is_a('midcom')) 296 294 { … … 304 302 } 305 303 } 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 so309 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 ( $metadata316 && ! $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 callback327 $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, and333 // execute the corresponding handler.334 debug_add('Doing additional component-level security check');335 $interface =& $component_loader->get_interface_class($document->component);336 if ( $interface337 && $topic338 && ! $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 371 304 $result[] = $document; 372 305 } trunk/midcom/midcom.core/midcom/services/indexer/document.php
r3766 r6137 347 347 { 348 348 // 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); 350 350 } 351 351 trunk/midcom/midcom.helper.search/config/manifest.inc
r5819 r6137 1 2 1 'name' => 'midcom.helper.search', 3 'version' => '1.0. 3beta1',2 'version' => '1.0.4beta1', 4 3 'state' => 'beta', 5 4 'purecode' => false, … … 23 22 'active' => 'no', 24 23 ), 24 'tarjei' => 25 array ( 26 'name' => 'Tarjei Huse', 27 'email' => 'tarjei@nu.no', 28 'role' => 'lead', 29 'active' => 'yes', 30 ), 31 25 32 ), 26 33 'dependencies' => … … 29 36 array ( 30 37 ), 38 'http_request' => 39 array ( 40 'channel' => 'pear.php.net', 41 ), 31 42 ), 32 43 ), trunk/midcom/midcom.helper.search/style/advanced_form.php
r5048 r6137 1 1 <?php 2 //$data =& $_MIDCOM->get_custom_context_data('request_data');2 $data =& $_MIDCOM->get_custom_context_data('request_data'); 3 3 $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX); 4 4 trunk/midcom/midcom.helper.search/style/search_form.php
r5048 r6137 1 <?php2 //$data =& $_MIDCOM->get_custom_context_data('request_data');3 ?>4 1 <h1><?php echo $data['topic']->extra;?></h1> 5 2 trunk/midcom/midcom.helper.search/viewer.php
r4120 r6137 58 58 case 'advanced': 59 59 $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'] : ''); 61 61 $data['component'] = (array_key_exists('component', $_REQUEST) ? $_REQUEST['component'] : ''); 62 62 $data['lastmodified'] = (array_key_exists('lastmodified', $_REQUEST) ? ((integer) $_REQUEST['lastmodified']) : 0); … … 105 105 if ( count(explode(' ', $data['query'])) == 1 106 106 && !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' ) 107 123 { 108 124 // Single search term, append * … … 110 126 } 111 127 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']); 127 129 $data['component'] = trim($_REQUEST['component']); 128 130 $data['lastmodified'] = (integer) trim($_REQUEST['lastmodified']); … … 136 138 } 137 139 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']})"; 141 143 } 142 144 else … … 145 147 } 146 148 147 if ($data[' topic'] != '')149 if ($data['request_topic'] != '') 148 150 { 149 151 if ($final_query != '') … … 151 153 $final_query .= ' AND '; 152 154 } 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 188 158 if ($data['component'] != '') 189 159 {
