Change in advancedsearch.php

Author Message

Juan Pablo Vercesi

Thursday 09 February 2006 8:49:49 am

Hi there,

I'm working on the search engine of a site, and have found this difference between two versions of eZ that I can't figure out why.

Originally, this site was in eZ 3.3.4, whose <i>/kernel/content/advancedsearch.php</i> file has the following lines (near line 120):

$searchContentClassID = -1;
$searchContentClassAttributes = 0;
$searchContentClassAttributeArray = array();
if ( $http->hasVariable( 'SearchContentClassID' ) and
     $http->variable( 'SearchContentClassID' ) != -1 )
{
    $searchContentClassID = $http->variable( 'SearchContentClassID' );
    $searchContentClass =& eZContentClass::fetch( $searchContentClassID );
    $searchContentClassAttributeArray =& $searchContentClass->fetchSearchableAttributes();
}

On the other hand, ez 3.6.5 has these on the same place:

$searchContentClassID = -1;
$searchContentClassAttributes = 0;
$searchContentClassAttributeArray = array();
if ( $http->hasVariable( 'SearchContentClassID' ) and
     $http->variable( 'SearchContentClassID' ) != -1 and
     (int)$http->variable( 'SearchContentClassID' ) > 0 )
{
    $searchContentClassID = (int)$http->variable( 'SearchContentClassID' );
    $searchContentClass =& eZContentClass::fetch( $searchContentClassID );
    if ( is_object( $searchContentClass ) )
        $searchContentClassAttributeArray =& $searchContentClass->fetchSearchableAttributes();
}

As you can see, the line inside the <i>if</i> block that assigns a value to <i>$searchContentClassID</i> has a type cast. This causes that if <i>$http->variable( 'SearchContentClassID' )</i> were returning an array (which, in fact, is my case), it is converted to an int, and the returning value is always 1 (my guess is that that conversion returns a "true" value, which is that the array exists).

I know that I can solve my 'problem' just removing the type casting, but I post this because I'd like to know why the type cast was added, how it changes the search behaviour and anything that could be related to it.

Thanks

JP,
may the source be with you.

Marko Žmak

Friday 19 May 2006 5:40:00 am

I also noticed this and reported it as a bug:

http://ez.no/bugs/view/8312

and also suggested a fix.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Nabil Alimi

Saturday 20 May 2006 5:52:55 am

Okkk my thread 1 line up there doesn't make sense anymore. :)

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

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 18 2025 22:57:42
Script start
Timing: Jan 18 2025 22:57:42
Module start 'layout'
Timing: Jan 18 2025 22:57:42
Module start 'content'
Timing: Jan 18 2025 22:57:43
Module end 'content'
Timing: Jan 18 2025 22:57:43
Script end

Main resources:

Total runtime1.6131 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 587.9141152.6250
Module start 'layout' 0.00530.0034 740.539139.4453
Module start 'content' 0.00871.6029 779.9844593.2578
Module end 'content' 1.61150.0015 1,373.242212.1641
Script end 1.6130  1,385.4063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.1982160.0002
Check MTime0.00120.0774160.0001
Mysql Total
Database connection0.00070.043310.0007
Mysqli_queries1.550596.1209590.0263
Looping result0.00070.0413570.0000
Template Total1.569597.320.7848
Template load0.00230.140920.0011
Template processing1.567297.159920.7836
Template load and register function0.00010.006010.0001
states
state_id_array0.00130.082510.0013
state_identifier_array0.00170.107420.0009
Override
Cache load0.00190.1159210.0001
Sytem overhead
Fetch class attribute can translate value0.00080.051530.0003
Fetch class attribute name0.00110.065960.0002
XML
Image XML parsing0.00560.347730.0019
class_abstraction
Instantiating content class attribute0.00000.000560.0000
General
dbfile0.00530.3301300.0002
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs