This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » Developer » eZFind moreLikeThis query specifying...

eZFind moreLikeThis query specifying fields to return

eZFind moreLikeThis query specifying fields to return

Saturday 08 June 2013 6:48:13 pm - 1 reply


I'm having some problems with the eZ Find moreLikeThis fetch function for 5.1.  I've run into a couple of problems with this feature and I'm hoping someone might have some suggestions:

  1. The moreLikeThis fetch function doesn't support the specifying of return fields
    • This I overcame by creating a custom fetch function to handle these parameters.  I then extended the eZSolr class to add handling of these attributes
  2. The biggest issue appears to be from Solr itself.  When you perform a normal fetch via eZFind, the return fields are included in the response header.  However, in a mlt fetch, this field is missing, despite that the doc results contain only the fields I specified.  Because of this, the results built will not include the specified fields unless they are 'meta' or 'as' fields.

Can anyone suggest a way to handle the second problem without having to rewrite the buildResultObjects method?  The only other way I can think of to get around this limitation is to inject the fields into the response header before calling buildResultObjects method.

Thanks in advance,

Thursday 04 July 2013 10:59:56 am

Hi Seiji,

maybe this is a solution for you:

The request to solr for mlt will be formed in ezfeZPSolrQueryBuilder::buildMoreLikeThis
There you can see there are just some hard coded meta fields in the field list (fl).

Of course we dont want to edit in the ez extensions.

I would create a new extension, add a new class implementing ezsolr, and add the method moreLikeThis there.
After the query builder did its work with
$queryParams = $queryBuilder->buildMoreLikeThis( $queryType, $queryValue, $params );
You can add own fields with concat into $queryParams['fl']
You may want to give the "additional fields" in the $params to the function.

Now you can create an own module-fetch-function like moreLikeThis with the additional fields parameter.

Hope this can help you



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from