-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(search): improved search snippet FE logic #6109
Merged
gabe-lyons
merged 4 commits into
datahub-project:master
from
gabe-lyons:gabe--searchSnippetFixes
Oct 4, 2022
Merged
feat(search): improved search snippet FE logic #6109
gabe-lyons
merged 4 commits into
datahub-project:master
from
gabe-lyons:gabe--searchSnippetFixes
Oct 4, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aditya-radhakrishnan
approved these changes
Oct 4, 2022
} | ||
|
||
return matchedFields.find((field) => FIELDS_TO_HIGHLIGHT.has(field.name)); | ||
return fromQueryGetBestMatch( | ||
matchedFields.filter((field) => FIELDS_TO_HIGHLIGHT.has(field.name)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it would be cleaner to give the first arg to this function a descriptive name
|
||
function fromQueryGetBestMatch(selectedMatchedFields: MatchedField[], rawQuery: string) { | ||
const query = normalize(rawQuery); | ||
// first lets see if there's an exact match between a field value and the query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the comments!
david-leifker
pushed a commit
to david-leifker/datahub
that referenced
this pull request
Oct 6, 2022
* starting improvements on search snippet * flesh out ranking logic * adding tests * responding to comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We used to only show search snippets for datasets if there was no description or title match. Now, we will show them regardless.
We used to just pluck out the first search snippet that came back & was relevant. Now, we do a few passes to try and find the best search snippet based on your query.
Added some unit tests & comments since we are encoding some business logic in this utility.
Checklist