CRM-7931 Display exact matches first for Quick Search, Shared Address lookup and other contact autocomplete fields

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.3.6
    • Fix Version/s: 3.4.1
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      It can be impossible to select organizations with relatively short names (e.g. 'ACT') from shared address, quick search or other auto-complete fields - because only the first 10 results are shown. So if there are > 9 other contact records with that string in their name - the organization you're looking for might not show up.

      Modify the autocomplete query to show any exact matches FIRST.

      ---- Original Description ----
      Hi

      When you / edit a contact / use shared address / look up the contact who the address will be shared with;

      The shared address lookup only lists ten contacts with no futher searching facility.
      This can cause issues.

      As an example we work with an organisation called ACT. When we use the lookup to share the address more than 10 other contacts are listed first therfore you cannot then see ACT and choose them as the shred address contact.

      Yours Oliver

        Attachments

          Activity

          [CRM-7931] Display exact matches first for Quick Search, Shared Address lookup and other contact autocomplete fields
          Kurund Jalmi added a comment -

          I think this behavior is true for all autocomplete widgets, you need to enter more details inorder to filter contacts.

          oliver gibson added a comment -

          Hi Kurund

          I'm not sure abiut this; in the example I gave the full organisation name 'ACT' meant that it was impossible to select the organisation as only 10 organisations with ACT in the title were displayed.

          Maybe a simple improvement would be to increase the number of matching contacts displayed?

          David Greenberg added a comment -

          Hi Oliver,
          The behavior of the "autocomplete" widget is indeed the same whether it's the Quick Search block on upper left corner (in menu bar), or the Select Contact for shared address. Currently it has a hard-coded limit of 10 on how many records it gives back. I think the reason for this is to minimize query load and make sure it returns values in a timely manner. Generally it works decently since the user can always type more letters to get their match (as kurund noted). However for organizational contacts with short names (or sites that have > 10 "Jones, Ann" records - it clearly is a problem.

          I'll chat w/ Kurund and Lobo about options for fixing this. How many items would YOU need to have returned in order to have a reasonable chance of getting your desired choices in the returned list? (You can test this a bit by typing in 'ACT' in the quick search box and hitting enter w/o selecting any items).

          David Greenberg added a comment -

          Assigning to lobo to investigate adding a UNION query which would cause exact matches to always be included in the results.

          Donald A. Lobo added a comment -

          I've added the union query, so exact always wins and is shown

          might want to consider doing the following:

          exact
          exact%
          %exact%

          right now it is:

          exact
          %exact%

          David Greenberg added a comment -

          Oliver - Would be great if you could double check this with your database. I think it will do the trick because 'ACT' will be first in the results (if the user types in 'act') since it's an exact match.

            People

            • Assignee:
              David Greenberg
              Reporter:
              oliver gibson

              Dates

              • Created:
                Updated:
                Resolved: