Changeset adc28f6


Ignore:
Timestamp:
08/31/10 16:44:59 (21 months ago)
Author:
Benoit Grégoire <benoitg@…>
Branches:
('master', '8434b8322dd6f8ff37c17bd45b94e7a826f86b53')('vitrine', 'afe109c61a407808bd54d88bcccb1cde726a010a')
Children:
f2cb64b2836c21c04a38954812e396eab23b9017
Parents:
f0daea643ebbade00cd85a4698420c4d1894a697
git-author:
Benoit Grégoire <benoitg@coeus.ca>2010-08-31 16:44:59-04:00
git-committer:
Benoit Grégoire <benoitg@coeus.ca>2010-08-31 16:44:59-04:00
Message:

Fix destToSource joins being ignored

File:
1 edited

Legend:

Unmodified
Added
Removed
  • html/classes/SearchEngine.php

    rf0daea6 radc28f6  
    620620            $finalJoinTable = $finalTable; 
    621621            $sql .= " vocabulary_terms AS {$finalTable} \n"; 
    622                         $sql .= " JOIN vocabulary_terms AS {$initialLeftTable} \n"; 
    623                        // $sql .= " JOIN vocabulary_terms AS {$finalJoinTable} \n"; 
     622            $sql .= " JOIN vocabulary_terms AS {$initialLeftTable} \n"; 
     623            // $sql .= " JOIN vocabulary_terms AS {$finalJoinTable} \n"; 
    624624        } 
    625625        if($navLevel>1) { 
     
    647647        $joinCondArray=array(); 
    648648        //navigableSourceToDest 
    649         $joinBackwards?$sourceToDestTypes=$navigableRelationships['navigableSourceToDest']:$sourceToDestTypes=$navigableRelationships['navigableSourceToDest']; 
     649        $joinBackwards?$sourceToDestTypes=$navigableRelationships['navigableDestToSource']:$sourceToDestTypes=$navigableRelationships['navigableSourceToDest']; 
    650650        if(count($sourceToDestTypes)>0){ 
    651651            $tmpSql = null; 
     
    655655 
    656656            $internaljoinCondArray = array(); 
    657              
     657 
    658658            foreach($sourceToDestTypes as $relationshipType) { 
    659659                $internaljoinCondArray[] = "(navigated_relationship_level_{$navLevel}.vdex_7_4_1_relationship_type_source='$relationshipType[1]' AND navigated_relationship_level_{$navLevel}.vdex_7_4_2_relationship_type_value='$relationshipType[0]') \n"; 
     
    665665        } 
    666666        //navigableDestToSource 
    667         $joinBackwards?$destToSourceTypes=$navigableRelationships['navigableSourceToDest']:$destToSourceTypes=$navigableRelationships['navigableSourceToDest']; 
     667        $joinBackwards?$destToSourceTypes=$navigableRelationships['navigableSourceToDest']:$destToSourceTypes=$navigableRelationships['navigableDestToSource']; 
    668668        if(count($destToSourceTypes)>0){ 
    669669            $tmpSql = null; 
     
    687687 
    688688        /* Re-joining with vocabulary_term is essential to exploit the nested-set structure later */ 
    689         $selectListArray[] = "navigated_relationship_level_{$navLevel}.vdex_7_4_2_relationship_type_value as RT"; 
     689        $selectListArray[] = "navigated_relationship_level_{$navLevel}.vdex_7_4_2_relationship_type_value as l{$navLevel}_RT"; 
    690690        $selectListArray[] = "navigated_relationship_level_{$navLevel}.source_term_identifier as l{$navLevel}_STid, navigated_relationship_level_{$navLevel}.target_term_identifier as l{$navLevel}_TTid"; 
    691691        $selectListArray[] = "navigated_terms_level_{$navLevel}.vdex_4_vocabulary_identifier as l{$navLevel}_voc, navigated_terms_level_{$navLevel}.vdex_6_1_identifier as l{$navLevel}_term"; 
     692 
    692693        $sqlVocTermJoin = null; 
    693694        $sqlVocTermJoin .= " LEFT JOIN vocabulary_terms AS {$rightTable} ON ( \n"; 
     
    715716            /* Re-joining with vocabulary_term is essential to exploit the nested-set structure later */ 
    716717            $selectListArray[] = "{$finalJoinTable}.vdex_4_vocabulary_identifier as final_voc, {$finalJoinTable}.vdex_6_1_identifier as final_term"; 
     718                    //$selectListArray[] = "array_agg(".implode(', ',$vocIdcoalesceParts).")"; 
    717719            $sqlFinalJoin = null; 
    718720            $sqlFinalJoin .= "  ON ( \n"; 
     
    760762                $sql .= " WHERE initial_theme_limit_terms.vdex_4_vocabulary_identifier='rVoc1' AND initial_theme_limit_terms.vdex_6_1_identifier='rVoc1T2'\n"; 
    761763                //$sql .= " WHERE vocabulary_terms.vdex_4_vocabulary_identifier='pivotVoc' AND vocabulary_terms.vdex_6_1_identifier='pivotVocT3'\n"; 
    762                 pretty_print_r($sql);ob_flush();flush(); 
     764                pretty_print_r($sql);@ob_flush();flush(); 
    763765                $db->ExecuterSql($sql, $rows, true); 
    764766                //pretty_print_r($navigableRelationships); 
     
    772774        } 
    773775        else { 
    774                         //Yes, that's an identity join, but we do need both names to be compatible with code above 
     776            //Yes, that's an identity join, but we do need both names to be compatible with code above 
    775777            $retval .= " vocabulary_terms AS theme_limit_terms JOIN vocabulary_terms AS initial_theme_limit_terms ON \n"; 
    776778            $retval .= " (theme_limit_terms.vdex_6_1_identifier=initial_theme_limit_terms.vdex_6_1_identifier AND theme_limit_terms.vdex_4_vocabulary_identifier=initial_theme_limit_terms.vdex_4_vocabulary_identifier)\n"; 
    777779        } 
    778                 //$retval .= " JOIN vocabulary_terms AS initial_theme_limit_terms ON  \n"; 
     780        //$retval .= " JOIN vocabulary_terms AS initial_theme_limit_terms ON  \n"; 
    779781        $retval .= ") ON (path_identifier=theme_limit_terms.vdex_6_1_identifier AND path_vdex_4_vocabulary_identifier=theme_limit_terms.vdex_4_vocabulary_identifier)  \n"; 
    780          
     782 
    781783        return $retval; 
    782784    } 
Note: See TracChangeset for help on using the changeset viewer.