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.
|