Forums / Extensions / eZ Find / Problem with not main nodes in SearchSubTreeArray

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

eZ debug

Timing: Jan 29 2025 13:47:05
Script start
Timing: Jan 29 2025 13:47:05
Module start 'content'
Timing: Jan 29 2025 13:47:05
Module end 'content'
Timing: Jan 29 2025 13:47:05
Script end

Main resources:

Total runtime0.0188 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.2031180.7656
Module start 'content' 0.00680.0051 768.9688103.7734
Module end 'content' 0.01190.0068 872.742278.6875
Script end 0.0187  951.4297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002111.1969120.0002
Check MTime0.00105.3295120.0001
Mysql Total
Database connection0.00073.892910.0007
Mysqli_queries0.004323.140040.0011
Looping result0.00000.181820.0000
Template Total0.006534.510.0065
Template load0.00084.256510.0008
Template processing0.005730.250710.0057
Override
Cache load0.00063.018210.0006
General
dbfile0.00168.2931100.0002
String conversion0.00000.015330.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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