Information for: DEVELOPERS   PARTNERS

Creating content recommendation blocks

A content recommendation block displays a small number of items related to the current page in a More Like This block. Here are a couple of examples:

"More Like This" example "More Like This" example

The Apache Solr Search module comes with a More Like This block already configured. You can configure this default block, or create other similar blocks, using the Pages/Blocks admin page.

To create a new content recommendation block, click Add search block “More Like This”.

Add search block "More Like This"

To configure an existing content recommendation block, click Configure under Operations.

Note

A content recommendation block uses data from the search index. If a user is viewing a node that hasn’t been added to the search index, any associated content recommendation block will be empty.

Configuring a content recommendation block

You can configure the block’s title, name (the string displayed to website visitors), and the maximum number of related items to display in the block.

Configuring "More like this" block

Tuning similarity comparisons

You may find the items returned in a content recommendation block aren’t a good match for the current item. You can experiment with the settings under Advanced Configuration and the settings under Fields for finding related content to receive better matches or performance.

  • Minimum term frequency
    A term must display X number of times in a document before it’s considered relevant for comparison.
  • Minimum document frequency
    This performance optimization feature sets the number of documents (Drupal content) that must contain similar content before comparisons can be made. This must be a minimum of two.
  • Minimum word length
    This performance optimization feature eliminates short words (such as “the” and “it”) from similarity comparisons.
  • Maximum word length
    This performance optimization feature eliminates overly long words from similarity comparisons.
  • Maximum number of query terms
    If a content recommendation doesn’t return any recommendations, you can either check more settings under Fields for finding related content or increase the maximum number of query terms here. This setting can affect your website performance.

Configuring filters

You can filter a content recommendation block by content types and by other queries.

Filtering by content types

Under Content Types, select the content types you want to include as related items.

Filtering by additional queries

Your content recommendation block can use queries to filter recommendations. In the Additional Query field, enter one or more comma-separated filter queries to apply by default. Query filters use Lucene query syntax. For information about Lucene query syntax, see Apache Lucene - Query Parser Syntax.

Configuring where to display content recommendation blocks

Like any other Drupal block, you can configure where and how a content recommendation block should display.

  • Use Region settings to select the page regions and themes where you want a content recommendation block to display.
  • Use Visibility settings to limit the display of a content recommendation block by page, content type, or role, or enable users to customize whether the block displays in their account settings.

Best practices for content recommendation blocks

Note the following best practices and recommendations for the use of recommendation blocks on your website.

Multiple recommendation blocks slow page load times

Every content recommendation block makes its own separate search query. Having several recommendation blocks on a node page can result in performance lag as requests are made by each block.

Page and block caching

When you use content recommendation blocks, it’s advisable to enable page and block caching on your website. To enable block caching, complete the following steps:

  1. In the admin menu, select Configuration, and then click Performance. The Performance page opens.
  2. Under Caching, select Cache blocks, and then click Save configuration.