Skip to content

Commit

Permalink
Fixed EZP-23407: an additional boolean is added in the output result …
Browse files Browse the repository at this point in the history
…set to mark if a result is elevated or not
  • Loading branch information
paulborgermans committed Oct 24, 2014
1 parent bbd3f3e commit b1c1217
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions classes/ezfezpsolrquerybuilder.php
Expand Up @@ -422,12 +422,16 @@ public function buildSearch( $searchText, $params = array(), $searchTypes = arra
$filterQuery = array( $fqString );
}

// Document transformer fields since eZ Find 5.4
$docTransformerFields = array( '[elevated]' );

$fieldsToReturnString = eZSolr::getMetaFieldName( 'guid' ) . ' ' . eZSolr::getMetaFieldName( 'installation_id' ) . ' ' .
eZSolr::getMetaFieldName( 'main_url_alias' ) . ' ' . eZSolr::getMetaFieldName( 'installation_url' ) . ' ' .
eZSolr::getMetaFieldName( 'id' ) . ' ' . eZSolr::getMetaFieldName( 'main_node_id' ) . ' ' .
eZSolr::getMetaFieldName( 'language_code' ) . ' ' . eZSolr::getMetaFieldName( 'name' ) .
' score ' . eZSolr::getMetaFieldName( 'published' ) . ' ' . eZSolr::getMetaFieldName( 'path_string' ) . ' ' .
eZSolr::getMetaFieldName( 'main_path_string' ) . ' ' . eZSolr::getMetaFieldName( 'is_invisible' ) . ' ' .
implode( ' ', $docTransformerFields) . ' ' .
implode( ' ', $extraFieldsToReturn );

if ( ! $asObjects )
Expand Down
4 changes: 3 additions & 1 deletion classes/ezfindresultnode.php
Expand Up @@ -24,7 +24,9 @@ function eZFindResultNode( $rows = array() )
'published',
'language_code',
'highlight',
'score_percent' );
'score_percent',
'elevated'
);
}

/*!
Expand Down
2 changes: 2 additions & 0 deletions search/plugins/ezsolr/ezsolr.php
Expand Up @@ -1656,6 +1656,7 @@ protected function buildResultObjects( $resultArray, &$searchCount, $asObjects =
}
$emit['highlight'] = isset( $highLights[$doc[ezfSolrDocumentFieldBase::generateMetaFieldName( 'guid' )]] ) ?
$highLights[$doc[ezfSolrDocumentFieldBase::generateMetaFieldName( 'guid' )]] : null;
$emit['elevated'] = ( isset($doc['[elevated]']) ? $doc['[elevated]'] === true : false );
$objectRes[] = $emit;
unset( $emit );
continue;
Expand Down Expand Up @@ -1739,6 +1740,7 @@ protected function buildResultObjects( $resultArray, &$searchCount, $asObjects =
*/
$maxScore != 0 ? $resultTree->setAttribute( 'score_percent', (int) ( ( $doc['score'] / $maxScore ) * 100 ) ) : $resultTree->setAttribute( 'score_percent', 100 );
$resultTree->setAttribute( 'language_code', $doc[ezfSolrDocumentFieldBase::generateMetaFieldName( 'language_code' )] );
$resultTree->setAttribute( 'elevated', ( isset($doc['[elevated]']) ? $doc['[elevated]'] === true : false ) );
$objectRes[] = $resultTree;
}
}
Expand Down

0 comments on commit b1c1217

Please sign in to comment.