spicygreenbook / greenbook-app

We are Spicy Green Book – a virtual directory for Black-owned food and beverage businesses throughout the US and Canada. We help Black-owned food and drink business owners tell their story, sowing the seeds of trust, support, and positive change within local communities.
https://www.spicygreenbook.org
46 stars 60 forks source link

Search Not Working Correctly #410

Open jabramso01 opened 3 years ago

jabramso01 commented 3 years ago

Describe the bug Searched for restaurants in Ashburn VA, and results show DC and Rockville first, Ashburn is 4th in the list.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://spicygreenbook.org/search?q=&near=ashburn+virginia
  2. See results

Expected behavior Ashburn would have been first in the list and the others would not be returned (Ashburn to DC is 35 miles or so).

Screenshots image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

JeroenGoddijn commented 3 years ago

To whomever starts to work on this. Even though the only user input on screen is "ashburn virginia" in the location field, I can see my browser console querying the database like this (I live in Houston, but have not entered that in the search box):

search info {q: "", near: "ashburn virginia", city: "Houston", state: "TX"}

I'm also not sure what sorting by "relevance" means, but one would assume that distance from searched city would be a factor in relevance.

danilobatson commented 3 years ago

To whomever starts to work on this. Even though the only user input on screen is "ashburn virginia" in the location field, I can see my browser console querying the database like this (I live in Houston, but have not entered that in the search box):

search info {q: "", near: "ashburn virginia", city: "Houston", state: "TX"}

I'm also not sure what sorting by "relevance" means, but one would assume that distance from searched city would be a factor in relevance.

@JeroenGoddijn I am can't speak to the sorting by relevance. Maybe @pleaseshutup can. I know it probably is a balance of checking how close of a match a listing is with distance, location entered, and any text input in the 'find' search box. When there no input in the 'find' search box do we recommend defaulting the search to sort by distance instead of relevancy score?

FuqingWang commented 2 years ago

I have been working on this bug for a quite while and would like to give some updates:

  1. The search grabs the user's current location by default if the input is empty(unless you manually turn off location sharing)
  2. The sort by relevance completely depends on the rank score geo API gives us. Sorted by distance is currently not part of the relevancy score calculation. I am currently working on incorporating distance as part of the relevancy score.

@danilobatson Danilo, can you assign this issue to me?

FuqingWang commented 2 years ago

bug fixed, suggest closing this issue.