Answers.Body: <p>If you're only trying to find related articles based on elements (ie tags, categories, entries, etc), you can use my <a href="https://github.com/aelvan/Similar-Craft" rel="nofollow noreferrer">Similar</a> plugin.</p>
  
  <p>Here's a basic example, more info in the repo:</p>
  
  <pre><code>{% set similarEntriesByTags = craft.similar.find({ element: entry, context: entry.tags }) %}
  
  &lt;ul&gt;
      {% for similarEntry in similarEntriesByTags %}
          &lt;li&gt;{{ similarEntry.title }} ({{ similarEntry.count }} tags in common)&lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-03T19:03:20.500Z
Answers.LastActivityDate: 2017-04-03T19:03:20.500Z
Answers.UserDisplayName: André Elvan
Answers.Body: <p>One way to do this would be to use <a href="https://craftcms.com/docs/templating/craft.tags#search" rel="nofollow noreferrer"><code>search</code></a> instead of <code>relatedTo()</code>, which will return a <code>searchScore</code> attribute an all of the resulting elements that is a measure of how well the search match was.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-03T18:15:22.473Z
Answers.LastActivityDate: 2017-04-03T18:15:22.473Z
Answers.UserDisplayName: Brad Bell
Body: <p>I am using the normal relatedTo property to find related articles, but I have an issue which is:</p>
  
  <pre><code>craft.entries.section('section').relatedTo("tags").id('not ' ~ entry.id).limit(3)
  </code></pre>
  
  <p>Lets say THIS article has 2 tags: "cat" and "animal", 
  then I use the normal relatedTo property to get related articles. 
  Lets say i want three articles</p>
  
  <p>Sometimes I get these three:</p>
  
  <ul>
  <li>article 1 (tags: "dog" and "animal")</li>
  <li>article 2 (tags: "cat" and "food")</li>
  <li>article 3 (tags: "mouse" and "animal")</li>
  </ul>
  
  <p>But not this one:</p>
  
  <ul>
  <li>article 4 (tags: "cat" and "animal")</li>
  </ul>
  
  <p>How can i get the MOST related articles always? I want the one that has the most matching tags, not just random ones that has at least 1 tag.</p>
  
Tags: <tags><relatedto>
Title: Most related articles
ThreadText: # Most related articles
  
  (Asked by: username_0 on 2017-04-03)
  
  I am using the normal relatedTo property to find related articles, but I have an issue which is:
  
  ```
  craft.entries.section('section').relatedTo("tags").id('not ' ~ entry.id).limit(3)
  
  ```
  
  Lets say THIS article has 2 tags: "cat" and "animal",
  then I use the normal relatedTo property to get related articles.
  Lets say i want three articles
  
  Sometimes I get these three:
  
  * article 1 (tags: "dog" and "animal")
  * article 2 (tags: "cat" and "food")
  * article 3 (tags: "mouse" and "animal")
  
  But not this one:
  
  * article 4 (tags: "cat" and "animal")
  
  How can i get the MOST related articles always? I want the one that has the most matching tags, not just random ones that has at least 1 tag.
  
  **Tags:** tags, relatedto
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-04-03. Score: 3
  
  If you're only trying to find related articles based on elements (ie tags, categories, entries, etc), you can use my [Similar](https://github.com/aelvan/Similar-Craft) plugin.
  
  Here's a basic example, more info in the repo:
  
  ```
  {% set similarEntriesByTags = craft.similar.find({ element: entry, context: entry.tags }) %}
  
  <ul>
      {% for similarEntry in similarEntriesByTags %}
          <li>{{ similarEntry.title }} ({{ similarEntry.count }} tags in common)</li>
      {% endfor %}
  </ul>
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2017-04-03. Score: 1
  
  One way to do this would be to use [`search`](https://craftcms.com/docs/templating/craft.tags#search) instead of `relatedTo()`, which will return a `searchScore` attribute an all of the resulting elements that is a measure of how well the search match was.
  
  
  ---
  
  