Index: trunk/extensions/MetavidWiki/MV_LocalSettings.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | * for more info on all overitable settings see base settings in MV_DefaultSettings.php |
10 | 10 | * eventually we should have some documentation somewhere ;) |
11 | 11 | */ |
12 | | -$mvExternalImages = false; |
| 12 | +$mvExternalImages = true; |
13 | 13 | $mvExternalImgServerPath = 'http://metavid.ucsc.edu/wiki/index.php'; |
14 | 14 | |
15 | 15 | // for sunlight network annalysis we include google analytics |
Index: trunk/extensions/MetavidWiki/includes/MV_Index.php |
— | — | @@ -188,6 +188,7 @@ |
189 | 189 | } |
190 | 190 | // slow epecialy for lots of query results but join Query is crazy complicated for SMW >= 1.2 |
191 | 191 | // (and I have not been able to construct it without hitting exessive number of rows in the EXPLIN) |
| 192 | + // @@todo these queries should be merged with semantic wiki Ask with some ~special~ keywords for fulltext search |
192 | 193 | if ( $do_smw_lookup ) { |
193 | 194 | $smwStore =& smwfGetStore(); |
194 | 195 | foreach ( $ret_ary as & $row ) { |
— | — | @@ -292,7 +293,8 @@ |
293 | 294 | $wgRequest, $mvDo_SQL_CALC_FOUND_ROWS, $mvMediaSearchResultsLimit; |
294 | 295 | |
295 | 296 | global $mvSpokenByInSearchResult, $mvCategoryInSearchResult, $mvBillInSearchResult; |
296 | | - |
| 297 | + |
| 298 | + |
297 | 299 | // init vars |
298 | 300 | $from_tables = ''; |
299 | 301 | $vars = $conds = $options = array(); |
— | — | @@ -414,7 +416,7 @@ |
415 | 417 | $valid_filter_count++; |
416 | 418 | break; |
417 | 419 | case 'smw_property': |
418 | | - // more complicated query work needed |
| 420 | + //@@todo merge doUnifiedFiltersQuery function with SMW Ask more complicated query work needed |
419 | 421 | break; |
420 | 422 | } |
421 | 423 | } |
— | — | @@ -429,8 +431,8 @@ |
430 | 432 | 'start_time, end_time, view_count, wiki_title,' . |
431 | 433 | $dbr->tableName( 'searchindex' ) . '.si_text AS `text` '; |
432 | 434 | |
433 | | - if ( $mvSpokenByInSearchResult ) |
434 | | - $vars .= ', smw_relations.object_title as spoken_by '; |
| 435 | + /*if ( $mvSpokenByInSearchResult ) |
| 436 | + $vars .= ', smw_relations.object_title as spoken_by ';*/ |
435 | 437 | |
436 | 438 | $from_tables .= $dbr->tableName( 'mv_mvd_index' ) . ' '; |
437 | 439 | $from_tables .= 'JOIN ' . $dbr->tableName( 'searchindex' ) . |
— | — | @@ -459,16 +461,16 @@ |
460 | 462 | // date range join: |
461 | 463 | |
462 | 464 | // include spoken by relation in results (LEFT JOIN should not be *that* costly ) |
463 | | - if ( $mvSpokenByInSearchResult ) { |
464 | | - /*$sql.="LEFT JOIN `smw_relations` ON (`mv_mvd_index`.`mv_page_id`=`smw_relations`.`subject_id` " . |
465 | | - "AND `smw_relations`.`relation_title`='Spoken_By') ";*/ |
| 465 | + /*if ( $mvSpokenByInSearchResult ) { |
| 466 | + //$sql.="LEFT JOIN `smw_relations` ON (`mv_mvd_index`.`mv_page_id`=`smw_relations`.`subject_id` " . |
| 467 | + // "AND `smw_relations`.`relation_title`='Spoken_By') "; |
466 | 468 | $from_tables .= 'LEFT JOIN ' . $dbr->tableName( 'smw_relations' ) . |
467 | 469 | ' ON ' . |
468 | 470 | '( ' . $dbr->tableName( 'mv_mvd_index' ) . '.mv_page_id = ' . |
469 | 471 | $dbr->tableName( 'smw_relations' ) . '.subject_id ' . |
470 | 472 | ' AND ' . $dbr->tableName( 'smw_relations' ) . '.relation_title = \'Spoken_By\'' . |
471 | 473 | ') '; |
472 | | - } |
| 474 | + }*/ |
473 | 475 | |
474 | 476 | // add conditions to last condition element (cuz we have to manually mannage and or): |
475 | 477 | |
— | — | @@ -558,6 +560,85 @@ |
559 | 561 | MV_Index::insert_merge_range( $stream_groups[$row->stream_id], $stream_groups, $row ); |
560 | 562 | } |
561 | 563 | } |
| 564 | + |
| 565 | + if( $mvCategoryInSearchResult){ |
| 566 | + $or=''; |
| 567 | + $conds=''; |
| 568 | + $options=array(); |
| 569 | + //build the category query conditions: |
| 570 | + foreach($ret_ary as $row){ |
| 571 | + if ( !isset( $ret_ary[$row->id]->category ) ) |
| 572 | + $ret_ary[$row->id]->categories = array(); |
| 573 | + |
| 574 | + $conds .= $or . ' cl_from =' . $dbr->addQuotes( $row->id ); |
| 575 | + $or = ' OR '; |
| 576 | + } |
| 577 | + //do the lookup: |
| 578 | + $from_tables = $dbr->tableName( 'categorylinks' ); |
| 579 | + $from_tables .= ' LEFT JOIN ' . $dbr->tableName( 'mv_mvd_index' ) . |
| 580 | + ' ON ( ' . |
| 581 | + $dbr->tableName( 'categorylinks' ) . '.cl_from = ' . |
| 582 | + $dbr->tableName( 'mv_mvd_index' ) . '.mv_page_id' . |
| 583 | + ' ) '; |
| 584 | + |
| 585 | + $vars = array( 'cl_from', 'cl_to' ); |
| 586 | + $options['LIMIT'] = 2000; // max avarage 5 categories per page |
| 587 | + |
| 588 | + $result_cat = $dbr->select( $from_tables, |
| 589 | + $vars, |
| 590 | + $conds, |
| 591 | + __METHOD__, |
| 592 | + $options ); |
| 593 | + while ( $cat_row = $dbr->fetchObject( $result_cat ) ) { |
| 594 | + $ret_ary[$cat_row->cl_from]->categories[$cat_row->cl_to] = true; |
| 595 | + } |
| 596 | + } |
| 597 | + |
| 598 | + if($mvSpokenByInSearchResult || $mvBillInSearchResult){ |
| 599 | + // slow epecialy for lots of query results but join Query is crazy complicated for SMW >= 1.2 |
| 600 | + // (and I have not been able to construct it without hitting exessive number of rows in the EXPLIN) |
| 601 | + // @@todo these queries should be merged with semantic wiki Ask with some ~special~ keywords for fulltext search |
| 602 | + $smwStore =& smwfGetStore(); |
| 603 | + foreach ( $ret_ary as & $row ) { |
| 604 | + //@@todo this is all very hackish but this is because SMW changed the db schema causing a few hacks: |
| 605 | + // obviously this should be rewritten to use some SMW based query system. |
| 606 | + $smw_properties=array(); |
| 607 | + if($mvSpokenByInSearchResult && strtolower(substr($row->wiki_title,0,2))=='ht') |
| 608 | + $smw_properties[]='spoken_by'; |
| 609 | + |
| 610 | + if($mvSpokenByInSearchResult && strtolower(substr($row->wiki_title,0,4))=='anno') |
| 611 | + $smw_properties[]='speech_by'; |
| 612 | + |
| 613 | + if($mvBillInSearchResult) |
| 614 | + $smw_properties[]='bill'; |
| 615 | + |
| 616 | + |
| 617 | + $rowTitle = Title::newFromText( $row->wiki_title, MV_NS_MVD ); |
| 618 | + foreach ( $smw_properties as $propKey ) { |
| 619 | + if ( $propKey != 'category' ) { |
| 620 | + $propTitle = Title::newFromText( $propKey, SMW_NS_PROPERTY ); |
| 621 | + $smwProps = $smwStore->getPropertyValues( $rowTitle, $propTitle ); |
| 622 | + // just a temp hack .. we need to think about this abstraction a bit.. |
| 623 | + if($propKey=='speech_by' || $propKey=='spoken_by'){ |
| 624 | + $v = current( $smwProps ); |
| 625 | + $row->spoken_by = $v->getXSDValue(); |
| 626 | + }else if($propKey=='bill'){ |
| 627 | + $row->bills=array(); |
| 628 | + foreach($smwProps as $v){ |
| 629 | + $row->bills[$v->getXSDValue()] = true; |
| 630 | + } |
| 631 | + } |
| 632 | + } |
| 633 | + } |
| 634 | + } |
| 635 | + } |
| 636 | + |
| 637 | + //print_r($ret_ary); |
| 638 | + //die; |
| 639 | + |
| 640 | + |
| 641 | + |
| 642 | + |
562 | 643 | // print "<pre>"; |
563 | 644 | // print_r($ret_ary); |
564 | 645 | // die; |
— | — | @@ -571,7 +652,7 @@ |
572 | 653 | } |
573 | 654 | }*/ |
574 | 655 | // do category & bill lookup for search result ranges |
575 | | - if ( $mvCategoryInSearchResult || $mvBillInSearchResult ) { |
| 656 | + /*if ( $mvCategoryInSearchResult || $mvBillInSearchResult ) { |
576 | 657 | $from_tables = $conds = ''; |
577 | 658 | $vars = $options = array(); |
578 | 659 | |
— | — | @@ -641,7 +722,7 @@ |
642 | 723 | } |
643 | 724 | // print "AFTER MERGE: "; |
644 | 725 | // print_r($ret_ary); |
645 | | - } |
| 726 | + }*/ |
646 | 727 | // print "<pre>"; |
647 | 728 | // print_r($ret_ary); |
648 | 729 | // die; |
Index: trunk/extensions/MetavidWiki/includes/MV_Hooks.php |
— | — | @@ -130,15 +130,16 @@ |
131 | 131 | * updates the time stamps when an article is moved |
132 | 132 | */ |
133 | 133 | function mvMoveHook( &$old_title, &$new_title, &$user, $pageid, $redirid ) { |
134 | | - global $mvgIP; |
| 134 | + global $mvgIP,$wgOut; |
135 | 135 | // die; |
136 | 136 | // confirm we are in the mvd Namespace & update the wiki_title |
137 | 137 | if ( $old_title->getNamespace() == MV_NS_MVD ) { |
138 | 138 | MV_Index::update_index_title( $old_title->getDBkey() , $new_title->getDBkey() ); |
139 | 139 | //remove the old MVD having lots of redirects around is not fun |
140 | 140 | $oldArticle = new Article($old_title); |
141 | | - $oldArticle->doDelete( wfMsg('mv_move_delete_msg'), false ); |
142 | | - |
| 141 | + $oldArticle->doDelete( wfMsg('mv_move_delete_msg'), false ); |
| 142 | + //clear output @@todo (should really check for errors and integrate info into move) |
| 143 | + $wgOut->clearHTML(); |
143 | 144 | } |
144 | 145 | |
145 | 146 | return true;// always return true, in order not to stop MW's hook processing! |