Answers.Body: <p>From the DB I can see that dedupe_rule_group_id 1 (in civicrm_dedupe_rule) has following rows</p>
  
  <p><code>id dedupe_rule_group_id    rule_table  rule_field  rule_length rule_weight
      1   1   civicrm_contact first_name  NULL    5
      2   1   civicrm_contact last_name   NULL    7
      3   1   civicrm_email   email   NULL    10</code></p>
  
  <p>and from civicrm_dedupe_rule_group we have 'threshold = 20'</p>
  
  <p><code>id contact_type    threshold   used    name    title   is_reserved
  1   Individual  20  Supervised  IndividualSupervised    Name and Email (reserved)   1</code></p>
  
  <p>ie
  First 5
  Last 7
  Email 10
  Threshold 20</p>
  
  <p>BUT - Jon points out that this is just a useless remnant from our evolutionary past so take his answer as the valid one.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-20T06:26:52.857Z
Answers.Text: This is the common-sense answer, but there's a special case at work here.  Be glad you haven't had cause to find out the truth the hard way!
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-18T22:52:28.417Z
Answers.LastActivityDate: 2016-12-20T18:14:36.480Z
Answers.LastEditDate: 2016-12-20T18:14:36.480Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>Pete's answer should be correct, but reserved dedupe rules don't work like normal rules.  The original assumption: First name, last name and email must all be identical - is correct.</p>
  
  <p>Dedupe rules with multiple criteria work by running a separate query for each criterion, filling a temp table with the weights.  This is flexible but inefficient, so the "reserved" queries are done using a single handwritten SQL query.  This particular query is found in <code>CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised::internal</code> and overrides the stored query in the database (which is the old query from before reserved queries existed).  Here's the query that runs.</p>
  
  <pre><code>        SELECT contact1.id as id1, contact2.id as id2, {$rg-&gt;threshold} as weight
          FROM civicrm_contact as contact1
            JOIN civicrm_email as email1 ON email1.contact_id=contact1.id
            JOIN civicrm_contact as contact2 ON
              contact1.first_name = contact2.first_name AND
              contact1.last_name = contact2.last_name
            JOIN civicrm_email as email2 ON
              email2.contact_id=contact2.id AND
              email1.email=email2.email
          WHERE contact1.contact_type = 'Individual'");
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-20T18:15:01.173Z
Answers.Text: Thanks Jon - I edited mine, but could delete if it makes more sense.
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-20T06:24:20.810Z
Answers.LastActivityDate: 2017-09-15T17:35:26.427Z
Answers.LastEditDate: 2017-09-15T17:35:26.427Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>The reserved dedupe rules don't tell us what they are doing behind the seens. The name and email (reserved) rule says:</p>
  
  <blockquote>
    <p>This reserved rule is pre-configured with matching fields to optimize
    dedupe scanning performance. It matches on:</p>
    
    <ol>
    <li>Email </li>
    <li>First Name</li>
    <li>Last Name</li>
    </ol>
  </blockquote>
  
  <p>But it doesn't reveal the length, weight or threshold?</p>
  
  <p>I'm kind of assuming that all three have to match exactly for civi to not create a duplicate record (unservised) or for it to not pop-up a duplicate warning (supervised).</p>
  
  <p>Am I correct?</p>
  
  <p>Thanks</p>
  
Tags: <duplicate-contacts>
Title: What are the Attributes for the Reserved DeDupe Rules
ThreadText: # What are the Attributes for the Reserved DeDupe Rules
  
  (Asked by: username_0 on 2016-12-16)
  
  The reserved dedupe rules don't tell us what they are doing behind the seens. The name and email (reserved) rule says:
  
  > This reserved rule is pre-configured with matching fields to optimize
  > dedupe scanning performance. It matches on:
  >
  > 1. Email
  > 2. First Name
  > 3. Last Name
  
  But it doesn't reveal the length, weight or threshold?
  
  I'm kind of assuming that all three have to match exactly for civi to not create a duplicate record (unservised) or for it to not pop-up a duplicate warning (supervised).
  
  Am I correct?
  
  Thanks
  
  **Tags:** duplicate-contacts
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-12-18. Score: 2 | Accepted answer
  
  From the DB I can see that dedupe\_rule\_group\_id 1 (in civicrm\_dedupe\_rule) has following rows
  
  `id dedupe_rule_group_id rule_table rule_field rule_length rule_weight
  1 1 civicrm_contact first_name NULL 5
  2 1 civicrm_contact last_name NULL 7
  3 1 civicrm_email email NULL 10`
  
  and from civicrm\_dedupe\_rule\_group we have 'threshold = 20'
  
  `id contact_type threshold used name title is_reserved
  1 Individual 20 Supervised IndividualSupervised Name and Email (reserved) 1`
  
  ie
  First 5
  Last 7
  Email 10
  Threshold 20
  
  BUT - Jon points out that this is just a useless remnant from our evolutionary past so take his answer as the valid one.
  
  > **Comments:**
  > **username_2**: This is the common-sense answer, but there's a special case at work here.  Be glad you haven't had cause to find out the truth the hard way!  
  
  ---
  
  ### Answer by username_2 on 2016-12-20. Score: 5
  
  Pete's answer should be correct, but reserved dedupe rules don't work like normal rules.  The original assumption: First name, last name and email must all be identical - is correct.
  Dedupe rules with multiple criteria work by running a separate query for each criterion, filling a temp table with the weights.  This is flexible but inefficient, so the "reserved" queries are done using a single handwritten SQL query.  This particular query is found in CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised::internal and overrides the stored query in the database (which is the old query from before reserved queries existed).  Here's the query that runs.
          SELECT contact1.id as id1, contact2.id as id2, {$rg->threshold} as weight
          FROM civicrm_contact as contact1
            JOIN civicrm_email as email1 ON email1.contact_id=contact1.id
            JOIN civicrm_contact as contact2 ON
              contact1.first_name = contact2.first_name AND
              contact1.last_name = contact2.last_name
            JOIN civicrm_email as email2 ON
              email2.contact_id=contact2.id AND
              email1.email=email2.email
          WHERE contact1.contact_type = 'Individual'");
  
  > **Comments:**
  > **username_1**: Thanks Jon - I edited mine, but could delete if it makes more sense.  
  
  ---
  
  