---
title: "Creating content recommendation blocks"
date: "2024-02-14T06:18:38+00:00"
summary: "Discover how to create and configure content recommendation blocks for your website. Learn to display related items, tune similarity comparisons, and optimize performance for better user engagement and content discovery."
image:
type: "page"
url: "/acquia-cloud-platform/creating-content-recommendation-blocks"
id: "d5fa3a9b-e905-4443-ac82-d405c4b23dee"
---

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:

![Search related posts example](https://acquia.widen.net/content/zs3zfmipku/jpeg/search_related-posts.jpeg?position=c&color=ffffffff&quality=80&u=soxprt) ![Search more like this example](https://acquia.widen.net/content/mknnklc2rr/jpeg/search_more-like-this.jpeg?position=c&color=ffffffff&quality=80&u=soxprt)

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”**.

![Apache Solr Search add more like this block](https://acquia.widen.net/content/5ltrrjaxge/jpeg/search_more-like-this-block.jpeg?position=c&color=ffffffff&quality=80&u=soxprt)

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.

Finding related content
-----------------------

You can configure which fields are matched by the search engine to find related items. Under **Fields for finding related content**, you can select one or more options:

*   The full rendered content (the node body)
    
*   Title or label
    
*   Path alias
    
*   Extra rendered content or keywords
    
*   Author name
    

You will receive the best results by selecting **Title or label** and **All taxonomy term names**.

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 does not 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](http://lucene.apache.org/core/3_6_0/queryparsersyntax.html).

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**.