Skip to content
Permalink
Browse files

Output a warning in logs when ezfind is activated, but server is not …

…running or using unpatched schema
  • Loading branch information...
emodric committed May 14, 2012
1 parent 7cd1a3e commit 3e695d8332bd5816e36236f0e24f1b974729e07d
Showing with 13 additions and 7 deletions.
  1. +13 −7 classes/ezjscoretagssuggest.php
@@ -63,6 +63,11 @@ public static function suggest( $args )
$tags = array();
$siteINI = eZINI::instance( 'site.ini' );
$returnArray = array();
$returnArray['status'] = 'success';
$returnArray['message'] = '';
$returnArray['tags'] = array();
if ( $siteINI->variable( 'SearchSettings', 'SearchEngine' ) == 'ezsolr' && class_exists( 'eZSolr' ) )
{
$tagsCount = 1;
@@ -99,10 +104,16 @@ public static function suggest( $args )
'FieldsToReturn' => null );
$searchResult = $solrSearch->search( '', $params );
$facetResult = $searchResult['SearchExtras']->attribute( 'facet_fields' );
$facetResult = $facetResult[0]['nameList'];
$searchError = $searchResult['SearchExtras']->attribute( 'error' );
if ( !empty( $searchError ) || !is_array( $facetResult ) || !is_array( $facetResult[0]['nameList'] ) )
{
eZDebug::writeWarning( 'There was an error fetching tag suggestions from Solr. Maybe server is not running or using unpatched schema?', __METHOD__ );
return $returnArray;
}
$tags = array();
foreach ( $facetResult as $facetValue )
foreach ( $facetResult[0]['nameList'] as $facetValue )
{
if ( !in_array( strtolower( $facetValue ), $filteredTagsArray ) )
{
@@ -117,11 +128,6 @@ public static function suggest( $args )
}
}
$returnArray = array();
$returnArray['status'] = 'success';
$returnArray['message'] = '';
$returnArray['tags'] = array();
foreach ( $tags as $tag )
{
if ( !$subTreeLimit > 0 || ( $subTreeLimit > 0 && strpos( $tag->attribute( 'path_string' ), '/' . $subTreeLimit . '/' ) !== false ) )

0 comments on commit 3e695d8

Please sign in to comment.
You can’t perform that action at this time.