department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
281 stars 198 forks source link

[Bug] Autocomplete API Inconsistent Results Based on Word Order #6006

Closed Mottie closed 10 months ago

Mottie commented 4 years ago

What happened?

This may be a problem with the autocomplete API. I don't know if the same API is used in multiple areas, but the behavior of the autocomplete seems similar.

The number of results is not consistent if you switch the word order:

Specs:

Steps to Reproduce

Using the GIBCT

  1. Go to https://staging.va.gov/gi-bill-comparison-tool/ (no need to log in)
  2. Type in "beauty academy" in the search; no dropdown results are seen
  3. Press Enter inside the input, or go to https://staging.va.gov/gi-bill-comparison-tool/search?category=school&name=beauty+academy - it will show 88 results
  4. Now in the search input at the top, enter "academy beauty"; only 1 result appears
  5. Press Enter inside the input, or go to https://staging.va.gov/gi-bill-comparison-tool/search?category=school&name=academy+beauty - it will show 1 result

New Disability

  1. Log into user 228
  2. Go to https://staging.va.gov/disability/file-disability-claim-form-21-526ez/introduction
  3. In step 1, choose "A new condition"
  4. In step 2, choose "Yes" to add a new condition
  5. Enter "left knee" and "knee left" to see the different, and unrelated, results.

Desired behavior

The autocomplete should display results that are related to the query and be consistent no matter the word order of the query

Acceptance Criteria

SMLuthi commented 4 years ago

Currently, the way the GIDS API is handling automatching on their end is by matching the search term from the beginning as opposed to matching the term anywhere in the string. This is due to how they wrote the index. This is the response I've gotten:

searching for a substring would be less efficient and that endpoint has caused cascading performance issues from a quantity vs. response perspective.

aka, it would severely hamper performance if we began searching any other way. I believe, to implement autocomplete how we want, would take a serious overhaul of that system.

saderagsdale commented 2 years ago

@cohnjesse is this something that the team can pick up if needed? Or is it a bug that doesn't have a clear pathway to resolution?

Mottie commented 2 years ago

@saderagsdale This is still a problem, but ultimately an issue with the platform code. I did try to add a method to include a custom algorithm, but I was told it'd be better to fix the core matching algorithm.

I don't think we should close this ticket, but we don't need to be assigned to it anymore.

cohnjesse commented 2 years ago

@saderagsdale it seems like it needs to be fixed at some point but there might not be a clear path forward. I would suggest we use a pre-built algorithm that works for what we need out of the box instead of doing our own. If what we are using doesn't fit the bigg then we may need to swap it out for something else. Also might be good to work with UX a bit to determine what exactly we are trying to achieve here.

jsokohl commented 2 years ago

Huge opportunity to coordinate with #sitewide-ia and other IA resources to consider taking a controlled vocabulary approach.