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

feat(search-by-field): Add match highlights to BaseSearchDAO #85

Merged
merged 1 commit into from
Mar 18, 2021

Conversation

dexter-mh-lee
Copy link
Contributor

Add the ability to highlight which part of the search document matched the query. This allows us to highlight any matches that do not show up in the preview (for instance, search for field names in a dataset will highlight the field name that matched the query)

In order for us to control the order of highlighted matches, the PDL matchMetadata field in SearchResultsMetadata holds a list of matched fields for each search element.

*** Tests ***
Once GMS is deployed with this version of gma,
http://localhost:8080/datasets?q=search&input=covid19

{
    "metadata": {
        "urns": [ ... ],
        "matches": [
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_usafacts.deaths",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_usafacts.confirmed_cases",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_italy.data_by_region",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_public_forecasts.state_14d",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_ecdc.covid_19_geographic_distribution_worldwide",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_public_forecasts.japan_prefecture_28d",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_public_forecasts.state_14d_historical",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_symptom_search.symptom_search_country_weekly",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_weathersource_com.county_day_forecast",
                        "fieldName": "name"
                    }
                ]
            },
            {
                "matchedFields": [
                    {
                        "fieldValue": "bigquery-public-data.covid19_weathersource_com.postal_code_day_forecast",
                        "fieldName": "name"
                    }
                ]
            }
        ],
        "searchResultMetadatas": [ ... ]
    },
    "elements": [ ... ],
    "paging": { ... }
}

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

Copy link
Contributor

@shirshanka shirshanka left a comment

Choose a reason for hiding this comment

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

LGTM!

@shirshanka
Copy link
Contributor

Merging this in since it should be backwards compatible.

@shirshanka shirshanka merged commit 47539f3 into linkedin:master Mar 18, 2021
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.

2 participants