Answers.Body: <p>First check that you have Automatic Wildcards enabled, navigate to <strong>Administer -> Customize Data and Screens -> Search Preferences</strong>, is the first option.</p>
  
  <blockquote>
    <p>If enabled, wildcards are automatically added to the beginning AND end
    of the search term when users search for contacts by Name. EXAMPLE:
    Searching for 'ada' will return any contact whose name includes those
    letters - e.g. 'Adams, Janet', 'Nadal, Jorge', etc. If disabled, a
    wildcard is added to the end of the search term only. EXAMPLE:
    Searching for 'ada' will return any contact whose last name begins
    with those letters - e.g. 'Adams, Janet' but NOT 'Nadal, Jorge'.
    Disabling this feature will speed up search significantly for larger
    databases, but users must manually enter wildcards ('%' or '_') to the
    beginning of the search term if they want to find all records which
    contain those letters. EXAMPLE: '%ada' will return 'Nadal, Jorge'.</p>
  </blockquote>
  
  <p>Check your display and sort name, navigate to <strong>Administer->Customize Data and Screens->Display Preferences</strong> at the bottom you have two fields, which by default should look something like this: </p>
  
  <p>Individual Display name format: <code>{contact.last_name}{, }{contact.first_name}</code></p>
  
  <p>Individual sort name format: <code>{contact.last_name}{, }{contact.first_name}</code></p>
  
  <p>If you want to search <strong>always by first name</strong> you can change the sort name format to <code>{contact.first_name}{ }{contact.last_name}</code>, now this will only apply for new contacts and <strong>not for the existing ones</strong>, you will have to update the <code>sort_name</code> for the existing contacts, there was a discussion in the <a href="https://forum.civicrm.org/index.php?topic=23125.0" rel="nofollow">forum</a> about this.</p>
  
  <p>If you search for "Adams," in the demo site you'll see that the result will be "Adams, Lou", as far as I'm concerned, this is expected behaviour.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Forgot to mention that you can use wildcards like: <code>%joe%</code>, that should include Joe Johnston and Johnston Joe if there is a existing contact by that name.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-14T21:38:29.583Z
Answers.Text: Thank you Andrei. That is very helpful. Is there a way to set up the search so it would find it if you searched by Mike Smith or Smith Mike?
Answers.UserDisplayName: 406CODE
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-14T21:43:09.687Z
Answers.Text: I don't think is currently possible without using wildcards, see the last addition in the answer, perhaps some of the core team could shed some light on that.
Answers.UserDisplayName: Andrei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-14T21:51:04.653Z
Answers.Text: I do have wildcards enabled. I'm sorry, I forgot to mention that.
Answers.UserDisplayName: 406CODE
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-14T21:56:54.043Z
Answers.Text: What is the sort name format set to?
Answers.UserDisplayName: Andrei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-14T22:09:05.863Z
Answers.Text: {contact.first_name}{  }{contact.last_name}
Answers.UserDisplayName: 406CODE
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-14T22:13:38.677Z
Answers.Text: And what is the result if you search for %joe% ? Also what version of Civi do you have installed?
Answers.UserDisplayName: Andrei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-18T13:26:22.313Z
Answers.Text: I get the correct results with these searches: 1. joe  2. johnston  3. johnston joe. However, I do not get any hits/results if I enter "joe johnston". Eventually the database being searched will be quite large and this would be an extremely helpful function.
Answers.UserDisplayName: 406CODE
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-18T18:37:17.973Z
Answers.Text: We have CiviCRM version 4.7.6 installed.
Answers.UserDisplayName: 406CODE
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-19T16:58:10.757Z
Answers.Text: I don't think there's a way to have both **Johnston Joe** or **Joe Johnston** working at the same time, the values that you have in your `Sort name format` will impact the way the `sort_name` is stored in the database for each contact, and therefore Civi's search and the way you enter the name in the search-box, resuming, **is a decision you'll have to make and stick with it**.
Answers.UserDisplayName: Andrei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-21T13:59:41.453Z
Answers.Text: Glad it helped, feel free to mark the question as answered so other people can benefit from it.
Answers.UserDisplayName: Andrei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-14T21:31:00.613Z
Answers.LastActivityDate: 2016-04-14T21:45:11.563Z
Answers.LastEditDate: 2016-04-14T21:45:11.563Z
Answers.UserDisplayName: Andrei
Answers.Body: <p>I know this is very old, but here's a solution for future reference:</p>
  <p>I've developed an extension that allows to search for <strong>sort_name OR display_name</strong> which would solve this issue in most configurations.</p>
  <p><a href="https://civicrm.org/extensions/search-display-name" rel="nofollow noreferrer">https://civicrm.org/extensions/search-display-name</a></p>
  <p>It's not extensively tested, so if you do run into issues let me know on github.</p>
  <hr />
  <p>There is another extension that allows for the same result although differently:</p>
  <p><a href="https://github.com/artfulrobot/alternativenamesearch" rel="nofollow noreferrer">https://github.com/artfulrobot/alternativenamesearch</a></p>
  <p>It patches the core to split the search terms and search for them individually.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-12T13:40:25.240Z
Answers.LastActivityDate: 2021-11-12T13:40:25.240Z
Answers.UserDisplayName: RAMIREZ
Body: <p>I would like to enable the basic intuitive functionality to search by first and last name in all search tools.</p>
  
  <p>Currently on our new install, with no other plugins enabled, I get "no matches found" if I search for firstname space lastname.</p>
  
  <p>Here is what I'm finding when I do these searches for a contact that does exist and does have a case associated with him.</p>
  
  <p>Search for joe, good results<br>
  Search for johnston, good results<br>
  <strong>Search for joe johnston, "no matches found"<br>
  Search for Joe Johnston, "no matches found"<br></strong>
  Search for johnston joe, good results<br>
  Search for Johnston Joe, good results</p>
  
  <p>I've found the same results using all of the below search locations which makes sense.<br>
  search > find contact <br>
  advanced search<br>
  cases > find cases<br>
  cases > open a case</p>
  
  <p>The quick search does display my contact as an option when I enter "joe".</p>
  
  <p>I would greatly appreciate any suggestions to get this working. It's a basic functionality that I assume can be enabled??</p>
  
  <p>I also tested this on the demo site for Lou Adams and got the same results. It seems to be the default functionality.</p>
  
  <p>Thanks so much for your help.</p>
  
Tags: <wordpress><search>
Title: can't search by first name last name; WordPress dashboard
ThreadText: # can't search by first name last name; WordPress dashboard
  
  (Asked by: username_0 on 2016-04-14)
  
  I would like to enable the basic intuitive functionality to search by first and last name in all search tools.
  
  Currently on our new install, with no other plugins enabled, I get "no matches found" if I search for firstname space lastname.
  
  Here is what I'm finding when I do these searches for a contact that does exist and does have a case associated with him.
  
  Search for joe, good results  
  Search for johnston, good results  
  **Search for joe johnston, "no matches found"  
  Search for Joe Johnston, "no matches found"**
  Search for johnston joe, good results  
  Search for Johnston Joe, good results
  
  I've found the same results using all of the below search locations which makes sense.  
  search > find contact   
  advanced search  
  cases > find cases  
  cases > open a case
  
  The quick search does display my contact as an option when I enter "joe".
  
  I would greatly appreciate any suggestions to get this working. It's a basic functionality that I assume can be enabled??
  
  I also tested this on the demo site for Lou Adams and got the same results. It seems to be the default functionality.
  
  Thanks so much for your help.
  
  **Tags:** wordpress, search
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-04-14. Score: 3
  
  First check that you have Automatic Wildcards enabled, navigate to **Administer -> Customize Data and Screens -> Search Preferences**, is the first option.
  
  > If enabled, wildcards are automatically added to the beginning AND end
  > of the search term when users search for contacts by Name. EXAMPLE:
  > Searching for 'ada' will return any contact whose name includes those
  > letters - e.g. 'Adams, Janet', 'Nadal, Jorge', etc. If disabled, a
  > wildcard is added to the end of the search term only. EXAMPLE:
  > Searching for 'ada' will return any contact whose last name begins
  > with those letters - e.g. 'Adams, Janet' but NOT 'Nadal, Jorge'.
  > Disabling this feature will speed up search significantly for larger
  > databases, but users must manually enter wildcards ('%' or '\_') to the
  > beginning of the search term if they want to find all records which
  > contain those letters. EXAMPLE: '%ada' will return 'Nadal, Jorge'.
  
  Check your display and sort name, navigate to **Administer->Customize Data and Screens->Display Preferences** at the bottom you have two fields, which by default should look something like this:
  
  Individual Display name format: `{contact.last_name}{, }{contact.first_name}`
  
  Individual sort name format: `{contact.last_name}{, }{contact.first_name}`
  
  If you want to search **always by first name** you can change the sort name format to `{contact.first_name}{ }{contact.last_name}`, now this will only apply for new contacts and **not for the existing ones**, you will have to update the `sort_name` for the existing contacts, there was a discussion in the [forum](https://forum.civicrm.org/index.php?topic=23125.0) about this.
  
  If you search for "Adams," in the demo site you'll see that the result will be "Adams, Lou", as far as I'm concerned, this is expected behaviour.
  
  **Edit**
  
  Forgot to mention that you can use wildcards like: `%joe%`, that should include Joe Johnston and Johnston Joe if there is a existing contact by that name.
  
  > **Comments:**
  > **username_0**: Thank you username_1. That is very helpful. Is there a way to set up the search so it would find it if you searched by Mike Smith or Smith Mike?  
  > **username_1**: I don't think is currently possible without using wildcards, see the last addition in the answer, perhaps some of the core team could shed some light on that.  
  > **username_0**: I do have wildcards enabled. I'm sorry, I forgot to mention that.  
  > **username_1**: What is the sort name format set to?  
  > **username_0**: {contact.first_name}{  }{contact.last_name}  
  > **username_1**: And what is the result if you search for %joe% ? Also what version of Civi do you have installed?  
  > **username_0**: I get the correct results with these searches: 1. joe  2. johnston  3. johnston joe. However, I do not get any hits/results if I enter "joe johnston". Eventually the database being searched will be quite large and this would be an extremely helpful function.  
  > **username_0**: We have CiviCRM version 4.7.6 installed.  
  > **username_1**: I don't think there's a way to have both **Johnston Joe** or **Joe Johnston** working at the same time, the values that you have in your `Sort name format` will impact the way the `sort_name` is stored in the database for each contact, and therefore Civi's search and the way you enter the name in the search-box, resuming, **is a decision you'll have to make and stick with it**.  
  > **username_1**: Glad it helped, feel free to mark the question as answered so other people can benefit from it.  
  
  ---
  
  ### Answer by username_2 on 2021-11-12. Score: 2
  
  I know this is very old, but here's a solution for future reference:
  
  I've developed an extension that allows to search for **sort\_name OR display\_name** which would solve this issue in most configurations.
  
  <https://civicrm.org/extensions/search-display-name>
  
  It's not extensively tested, so if you do run into issues let me know on github.
  
  ---
  
  There is another extension that allows for the same result although differently:
  
  <https://github.com/artfulrobot/alternativenamesearch>
  
  It patches the core to split the search terms and search for them individually.
  
  
  ---
  
  