Problem with not main nodes in SearchSubTreeArray

Author Message

Serhey Dolgushev

Friday 29 October 2010 4:49:44 am

Hi everyone!

Today i discoverd a troubles with searching non main nodes. I`ll try to explaine the problem:

We have object O1 (name: "test"), with multiple locations:

  • N1 (main, node_id:101, path:1/2/60/101)
  • N2 (node_id:102, path: 1/2/62/102)
  • N3 (node_id:103, path: 1/2/63/103)

I`m doing the next:

$solrSearch   = new eZSolr();
$searchResult = $solrSearch->search(
    'test',
    array(
        'SearchSubTreeArray' => array( 62 ),
        'SpellCheck' => array( true ),
        'SearchType' => array( 'fulltext' ),
        'SearchLimit' => 10,
        'SearchOffset' => 0
    )
)

$searchResult['SearchResult'] should contain the eZFindResultNode object with node_id = 102. But it contains eZFindResultNode object with node_id = 101. Its because $searchResult['SearchResult'] allways contains just main nodes.

In my case i didn`t used score_percent and highlight attributes, so i fixed it the next way:

foreach( $searchResult['SearchResult'] as $key => $node ) {
    if( in_array( $parentNodeID, $node->attribute( 'path_array' ) ) === false ) {
        $locations = $node->attribute( 'object' )->attribute( 'assigned_nodes' );
        foreach( $locations as $locationNode ) {
            if( in_array( $parentNodeID, $locationNode->attribute( 'path_array' ) ) === true ) {
                $nodeRow  = eZContentObjectTreeNode::fetch( $locationNode->attribute( 'node_id' ), false, false );
                $findNode = new eZFindResultNode( $nodeRow );
                $findNode->setContentObject( new eZContentObject( $nodeRow ) );
                $findNode->setAttribute( 'name', $locationNode->attribute( 'name' ) );
                $findNode->setAttribute( 'published', $locationNode->attribute( 'published' ) );
                $findNode->setAttribute( 'global_url_alias', $locationNode->attribute( 'url_alias' ) );
                $findNode->setAttribute( 'language_code', $locationNode->attribute( 'object' )->attribute( 'current_language' ) );
                $findNode->setAttribute( 'is_local_installation', true );
                
                $searchResult['SearchResult'][ $key ] = $findNode;
                break;
            }
        }
    }
}

But i think it will be great if this bug will be fixed in eZ Find, and $searchResult['SearchResult'] will contain no only main nodes :)

Nicolas Pastorino

Friday 29 October 2010 7:02:29 am

Hi Serhey,

Which version of eZ Find are you using ?

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Serhey Dolgushev

Saturday 30 October 2010 3:58:17 am

Its 2.2-0

Paul Borgermans

Sunday 31 October 2010 1:23:33 pm

Hi Serhey

Can you file a bug report/enhancement request referrring to this thread? Your use case is not the only one, so some flexibility on this should be introduced ... sometimes, the main node is what one really wants.

Regards

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Serhey Dolgushev

Thursday 04 November 2010 3:58:01 pm

Hi Paul. I did it: http://issues.ez.no/IssueView.php?Id=17576&activeItem=3

Paul Borgermans

Saturday 06 November 2010 3:08:21 am

Thanks Serhey!

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 29 2025 23:46:14
Script start
Timing: Jan 29 2025 23:46:14
Module start 'layout'
Timing: Jan 29 2025 23:46:14
Module start 'content'
Timing: Jan 29 2025 23:46:14
Module end 'content'
Timing: Jan 29 2025 23:46:14
Script end

Main resources:

Total runtime0.0205 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.4063151.2422
Module start 'layout' 0.00630.0048 739.648436.7188
Module start 'content' 0.01120.0079 776.3672100.0156
Module end 'content' 0.01910.0013 876.382841.9766
Script end 0.0205  918.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002713.1556140.0002
Check MTime0.00125.7364140.0001
Mysql Total
Database connection0.00094.289510.0009
Mysqli_queries0.004321.144330.0014
Looping result0.00000.126710.0000
Template Total0.00104.910.0010
Template load0.00083.778210.0008
Template processing0.00021.106410.0002
Override
Cache load0.00052.520710.0005
General
dbfile0.003014.649080.0004
String conversion0.00000.058140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs