healthyregions / SDOHPlace

Landing page and data discovery application for SDOH Place Project.
https://sdohplace.org
GNU General Public License v3.0
1 stars 1 forks source link

#265: fix the auto suggestor #299

Closed pengyin-shan closed 2 months ago

pengyin-shan commented 2 months ago

This PR is for #265. It enables the auto-suggest feature after the user inputs anything in the search box.

How to Test

  1. Go to the search page and type anything in the search box. You should see the auto-suggestion feature enabled again:

    Screenshot 2024-09-19 at 11 06 05 AM
  2. Click on one of the results (for example, southwest coastal alaska). You should see the result list appear after the query:

    Screenshot 2024-09-19 at 11 08 14 AM
  3. Run a sort or filter, and the result list should adjust as expected:

    Screenshot 2024-09-19 at 11 08 24 AM

NOTE

@mradamcox : while fixing the suggestion feature, I noticed an issue that I want to confirm with you. One example is "southeast coastal Alaska," which was suggested by Solr. Our existing rule for generating the parent object from the child object resulted in no results.

When I checked the query (https://solr.sdohplace.org/solr/blacklight-core-dev/select?q=southeast%20coastal%20alaska&fq=&rows=1000), it appears that all the results have a parent of "tree-canopy-cover." However, the returned result doesn't include a "tree-canopy-cover" item. Instead, we only have items like "tree-canopy-cover-alaska2013" and "tree-canopy-cover-alaska2014."

On the other hand, we do have a "Tree Canopy Cover" object in the database. If a user enters "Tree Canopy Cover" directly and then selects any of the returned results from the drop-down or directly searches this term, it will appear. However, this item doesn't include "southeast coastal Alaska," so it doesn't show up in the above search.

To address this, I changed the rule so that if the parent item is not in the returned list, all the child objects are shown instead. Please let me know if this change makes sense. We can also update the Solr rule to ensure that if all child items are returned, the parent item must also be included.

netlify[bot] commented 2 months ago

Deploy Preview for cheerful-treacle-913a24 ready!

Name Link
Latest commit c41ad8444797836c4bbce7b85b80a61bed54e089
Latest deploy log https://app.netlify.com/sites/cheerful-treacle-913a24/deploys/66ec98afd3476f00083810e2
Deploy Preview https://deploy-preview-299--cheerful-treacle-913a24.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.