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

Add search relevance criteria to DBT search function #113

Merged
merged 4 commits into from
Aug 3, 2020

Conversation

stephen8chang
Copy link
Contributor

@stephen8chang stephen8chang commented Jul 24, 2020

Problem

In the DBT search function, search results are sorted in alphabetical order by the model name. This is not optimal for a search function, and can cause some difficulty for visibility of relevant search results for the user.

Solution

To solve this issue, this PR adds a "weight" criteria to each search result, which is an indication of how relevant it is to the user (the larger the number, the more relevant). To specify, weight will be added to a search result if the search query matches the name, tags, description, SQL code, or columns, whose weights are biggest to smallest in that respective order. Based on this, the order of the search results is sorted from the greatest to least "weight," and therefore allows for easier visibility of more relevant search results for the user.

Other Information

@jtcohen6
Copy link
Contributor

jtcohen6 commented Aug 2, 2020

Very nice! I agree with the motivation behind this change, and with the weights you've given so far.

I'm not sure if this is review-ready, so I'll just share that I took it for a spin and I've been running into an issue where the docs site is freezing. This happens any time, after having typed text into the search bar:

  • when I press "x" to clear the search
  • when I attempt to delete the last remaining letter in the search bar
  • when I try to click on one of the search results

@stephen8chang
Copy link
Contributor Author

stephen8chang commented Aug 3, 2020

@jtcohen6 Thanks for the catch. I inserted a conditional in the assignSearchRelevance function so these cases are taken care of.

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

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

This is awesome, thanks for the contribution!

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.

Add search relevance criteria to DBT search function
2 participants