I have a Drupal 6 site with an Apache Solr search index. I'm trying to create a block that displays 'related content', much like Stack Exchange sites have 'related' in the sidebar of questions. The modules Apachesolr_views seems like a good candidate, but it's current development status and issue queue is less than inviting. Does anyone have suggestions of a straightforward way to implement this?
1 Answer
The feature is actually built in to apachesolr.module. It is called 'mlt' (short for More Like This).
You can add differently configured MLT blocks via ?q=admin/settings/apachesolr/mlt/add_block
and then configure their visibility in ?q=admin/build/block
or whatever block visibility mechanism you are using (context etc).
-
1Nice! It never ceases to amaze me how Drupal developers spend weeks/months writing modules that do incredible things and then don't write a single character of documentation about it on the project page or readme file. Aug 29, 2012 at 14:11
-
hook_apachesolr_update_index
to add a new index term for related contents' node id based on your related nodes logic (ex. sharing same taxonomy term or having same author etc.) and in your search results fetch the same if necessary withhook_apachesolr_modify_query
with custom logic to show node title and teaser or whatever the display demands using the node's id