Skip to content
Browse files

Fixed #18468: moreLikeThis query, when passed a node ID or object ID,

does not specify an installation ID

Also make possible to specify the installation id to use to search for
the reference document in the Solr when using the template fetch
function. Based on the pull request #13 from Peter Keung.
  • Loading branch information...
1 parent 9d5e066 commit 604a44ba289cec793feac11b7bbac890577c96a8 @dpobel dpobel committed Aug 5, 2011
View
3 classes/ezfezpsolrquerybuilder.php
@@ -668,6 +668,7 @@ public function buildMoreLikeThis( $queryType, $query, $params = array() )
eZDebug::writeDebug( $params, 'mlt params' );
$searchCount = 0;
+ $queryInstallationID = ( isset( $params['QueryInstallationID'] ) && $params['QueryInstallationID'] ) ? $params['QueryInstallationID'] : eZSolr::installationID();
$offset = ( isset( $params['SearchOffset'] ) && $params['SearchOffset'] ) ? $params['SearchOffset'] : 0;
$limit = ( isset( $params['SearchLimit'] ) && $params['SearchLimit'] ) ? $params['SearchLimit'] : 10;
$subtrees = isset( $params['SearchSubTreeArray'] ) ? $params['SearchSubTreeArray'] : array();
@@ -757,9 +758,11 @@ public function buildMoreLikeThis( $queryType, $query, $params = array() )
{
case 'nid':
$mltQuery = eZSolr::getMetaFieldName( 'node_id' ) . ':' . $query;
+ $mltQuery .= ' AND ' . eZSolr::getMetaFieldName( 'installation_id' ) . ':' . $queryInstallationID;
break;
case 'oid':
$mltQuery = eZSolr::getMetaFieldName( 'id' ) . ':' . $query;
+ $mltQuery .= ' AND ' . eZSolr::getMetaFieldName( 'installation_id' ) . ':' . $queryInstallationID;
break;
case 'url':
$mltVariant = 'stream.url';
View
5 classes/ezfmodulefunctioncollection.php
@@ -163,12 +163,14 @@ public function rawSolrRequest( $baseURI, $request, $parameters = array() )
* @param mixed Content class ID or list of content class IDs
* @param array list of subtree limitation node IDs
* @param boolean asObjects return regular eZPublish objects if true, stored Solr content if false
+ * @param string|null $queryInstallationID the eZ Find installation id to
+ * use when looking for the reference document in Solr
*
* @return array result as a PHP array
*/
public function moreLikeThis( $queryType, $query, $offset = 0, $limit = 10, $facets = null,
$filters = null, $sortBy = null, $classID = null, $sectionID = null,
- $subtreeArray = null, $asObjects = true )
+ $subtreeArray = null, $asObjects = true, $queryInstallationID = null )
{
$solrSearch = new eZSolr();
@@ -180,6 +182,7 @@ public function moreLikeThis( $queryType, $query, $offset = 0, $limit = 10, $fac
'SearchContentClassID' => $classID,
'SearchSectionID' => $sectionID,
'SearchSubTreeArray' => $subtreeArray,
+ 'QueryInstallationID' => $queryInstallationID,
'AsObjects' => $asObjects);
return array( 'result' => $solrSearch->moreLikeThis( $queryType, $query, $params ) );
View
6 modules/ezfind/function_definition.php
@@ -211,7 +211,11 @@
array( 'name' => 'as_objects',
'type' => 'boolean',
'required' => false,
- 'default' => true ) ) );
+ 'default' => true ),
+ array( 'name' => 'query_installation_id',
+ 'type' => 'string',
+ 'required' => false,
+ 'default' => null ) ) );
$FunctionList['elevateConfiguration'] = array( 'name' => 'elevateConfiguration',
'operation_types' => 'read',

0 comments on commit 604a44b

Please sign in to comment.
Something went wrong with that request. Please try again.