Answers.Body: <p>I remember there was a patch for a contact type search...let me dig....that was with CiviCRM 4.6 and the issue was <a href="https://issues.civicrm.org/jira/browse/CRM-18063" rel="nofollow noreferrer">https://issues.civicrm.org/jira/browse/CRM-18063</a>. The patch worked for me, but I am not sure if you have the same problem?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-29T08:11:27.450Z
Answers.LastActivityDate: 2017-03-29T08:11:27.450Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I'm working on a site that uses several contact subtypes for the Organisation contact type. Following a recent upgrade, everything seems to be working fine, but a basic or advanced search for contacts of this particular subtype gives zero results. Searches for other contact subtypes are working fine. Looking at the database I can see that there are in excess of 1300 contact records with this contact subtype, and they aren't in the trash.</p>
  
  <p>Any thoughts on what the issue might be, how to fix it, or how to work around it (I was thinking about the possibility of creating a new contact subtype and applying this to all of the records - assuming of course that I can find them!).</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-29T08:55:42.717Z
Comments.Text: What version are you on now?  Is the subtype enabled at Administer > Customise > Contact Types?
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-02T21:13:41.313Z
Comments.Text: Hi Aidan. I'm running 4.7.16 and yes the subtype is enabled. Here's the thing: if I find a record that I know to be of this subtype, edit and save the record without making any changes, it then shows up when I search for contacts of the that subtype. What's happening here? Is there some neat way to update all records so that this gets resolved? I hope so.
Comments.UserDisplayName: Graham
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-03T08:42:10.340Z
Comments.Text: I'd dig around a bit using SQL & API to compare a record that is showing correctly with one that is not to try to understand the difference.  You could try the api version of your edit/no-change/save ie `civicrm_api3('Contact', 'create', array('id' => an_existing_broken_id))`.  You may need to specify more parameters. If that works, you could just loop through your contacts with that.
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-26T22:35:24.150Z
Comments.Text: Strangely I just encountered the same issue on 5.62.1 - Basic or Advanced search for a subtype (or D9 view of the same) returns no records while Searchkit, API and a select query on db find them just fine. The workaround given by Graham above still works - edit through GUI without changing anything. Using API to reapply the subtypes to all relevant contacts also worked. To be fair I have been messing around with the subtypes a bit! . Recording this here in case useful to others to know that this can still happen.
Comments.UserDisplayName: Jon Halle
Tags: <contacts><sub-types>
Title: Why is my search for a specific contact subtype giving no results?
ThreadText: # Why is my search for a specific contact subtype giving no results?
  
  (Asked by: username_0 on 2017-03-29)
  
  I'm working on a site that uses several contact subtypes for the Organisation contact type. Following a recent upgrade, everything seems to be working fine, but a basic or advanced search for contacts of this particular subtype gives zero results. Searches for other contact subtypes are working fine. Looking at the database I can see that there are in excess of 1300 contact records with this contact subtype, and they aren't in the trash.
  
  Any thoughts on what the issue might be, how to fix it, or how to work around it (I was thinking about the possibility of creating a new contact subtype and applying this to all of the records - assuming of course that I can find them!).
  
  **Tags:** contacts, sub-types
  
  > **Comments:**
  > **username_1**: What version are you on now?  Is the subtype enabled at Administer > Customise > Contact Types?  
  > **username_0**: Hi username_1. I'm running 4.7.16 and yes the subtype is enabled. Here's the thing: if I find a record that I know to be of this subtype, edit and save the record without making any changes, it then shows up when I search for contacts of the that subtype. What's happening here? Is there some neat way to update all records so that this gets resolved? I hope so.  
  > **username_1**: I'd dig around a bit using SQL & API to compare a record that is showing correctly with one that is not to try to understand the difference.  You could try the api version of your edit/no-change/save ie `civicrm_api3('Contact', 'create', array('id' => an_existing_broken_id))`.  You may need to specify more parameters. If that works, you could just loop through your contacts with that.  
  > **username_2**: Strangely I just encountered the same issue on 5.62.1 - Basic or Advanced search for a subtype (or D9 view of the same) returns no records while Searchkit, API and a select query on db find them just fine. The workaround given by username_0 above still works - edit through GUI without changing anything. Using API to reapply the subtypes to all relevant contacts also worked. To be fair I have been messing around with the subtypes a bit! . Recording this here in case useful to others to know that this can still happen.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2017-03-29. Score: 2
  
  I remember there was a patch for a contact type search...let me dig....that was with CiviCRM 4.6 and the issue was <https://issues.civicrm.org/jira/browse/CRM-18063>. The patch worked for me, but I am not sure if you have the same problem?
  
  
  ---
  
  