Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMPB-1513 non-US state abbreviations like those from a650 VNMLS are not detected by the Omnibar search JS, causing incorrect search results #506

Open
wants to merge 1 commit into
base: release/3.1.0
Choose a base branch
from

Conversation

lainvineyard
Copy link
Contributor

Pull Requests

🐛 Are you fixing a bug? Y

The plugin uses a hardcoded list of states to detect when parsing the Omnibar input and trying to determine what CCZ id should be used when handling an input like “City, StateAbreviation”.

Some example state abbreviations from VNMLS include JAL and NAY. These are not included in the current hardcoded list, so they are not detected by the whatState function. This results in an address search being performed even if a valid state abbreviation is entered, which usually results in 0 results.

Template

Description of the Change

A set is used to keep track of all state abbreviations found in the locationlist.js file for later reference when the user input is parsed to determine what type of search to make.

Verification Process

  1. Add the API key of an account using a650 VNMLS to a test WordPress site.
  2. Add the Omnibar to a test page on the site and publish the page.
  3. Type in "Airport" and press enter. It should autocomplete to "Airport, JAL".
  4. Submit the search through the Omnibar.
  5. Note that the search results you are directed to are for an address search for Airport, like "idx/results/listings?pt=&aw_address=Airport&srt=&idxStatus[]=active&idxStatus[]=sold"
  6. Apply the fix in the PR to the plugin.
  7. Re-gulp the JS and apply the changes to the test site.
  8. Refresh the Omnibar page and perform the same search starting with typing in "Airport"
  9. Note that you are now correctly directed to a search using the CCZ ID for Airport, JAL, like "idx/results/listings?pt=&ccz=city&city[]=20&srt="

Release Notes

Fix: Handle more non-US state abbreviations when performing an Omnibar search.

Review

Pull Requests must have the sign-off of two other developers and at least one of these must be an IDX Broker team member.

…z ID is used for locations in states like NAY and JAL in VNMLS

this avoids having to rely on a hardcoded list of state abbreviations
// Add state abbreviations to the set for later reference
array.forEach((item) => {
if (item.stateAbrv) {
console.log(item.stateAbrv);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this console log is needed. Everything else looks like it works fine! Good stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants