Step 2: Use Frontend Logic (Automatic)

  1. Set up the location entities and link them to the professional entity. For a refresher, check out the Linked Entities training.
  2. In the configuration for the professionals vertical, make the geolocation of those linked facilities searchable. For a refresher, check out the trainings on making entity relationships searchable and enabling geolocation filters across entity relationships . This will return this professional entity for searches that are relevant to all their address locations. Note you can only add this in the JSON editor, which will look something like:

    {
      "verticals": {
        "professionals": {
        "searchableFields": {
          "c_practicingLocations.builtin.location": {
            "nlpFilter": true
            }
          }
        }
      }
    }
  3. Populate display fields with at least one projected coordinate field. We recommend using yextDisplayCoordinate because that’s the primary coordinate for an entity. For a refresher on display fields, check out the searchable and display fields unit.

  4. Run a search using Test Search to view the API response. Notice that within the list of linked locations for each professional entity, the API response will indicate which linked location is closest to the user (by setting nearestToUser to true) and which is closest to any searched location filter (by setting nearestToFilter to true). nearestToFilter will only be populated if there’s a matched location filter for the search, such as “doctors in Arlington” matching on Arlington.

  5. Now that the API response is returning nearestToUser and nearestToFilter, you can use these properties to implement frontend logic to choose which entities to display. Every setup will look different, but essentially you’ll use a logic statement to show the result card of the entity with nearestToUser or nearestToFilter set to true and not show the result cards of the entities that don’t have this property. This will allow you to surface only one result card per professional.

Note: Since you are using frontend logic to choose which entities to display, the frontend may show different results than Search Logs, API responses, and Analytics. This could potentially cause issues for dynamic reranking, sorting logic, or troubleshooting the experience. Keep this in mind while debugging.

Feedback