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

Allow search results to be filtered by name only #2114

Merged
merged 2 commits into from
Feb 20, 2024
Merged

Allow search results to be filtered by name only #2114

merged 2 commits into from
Feb 20, 2024

Conversation

Iinh
Copy link
Contributor

@Iinh Iinh commented Feb 5, 2024

Fixes #2113.

This PR introduces a new search filter that allows searching by names only. For example searching name:browser.search. will return only these results.

https://deploy-preview-2114--glean-dictionary-dev.netlify.app/apps/fenix?page=1&search=name%3Abrowser.search

CleanShot 2024-02-05 at 13 17 11@2x

Pull Request checklist

  • The pull request has a descriptive title (and a reference to an issue it
    fixes, if applicable)
  • All tests and linter checks are passing
  • The pull request is free of merge conflicts

@Iinh Iinh marked this pull request as ready for review February 9, 2024 22:12
@Iinh
Copy link
Contributor Author

Iinh commented Feb 9, 2024

@Dexterp37 could you review this PR? Thanks 🙇‍♀️

@Iinh Iinh requested a review from Dexterp37 February 9, 2024 22:13
const searchIndex = generateSearchIndex(searchItems);

searchTerms.forEach((term) => {
if (
term.startsWith("tags:") ||
term.startsWith("origin:") ||
term.startsWith("type:") ||
term.startsWith("expires:")
Copy link
Contributor

Choose a reason for hiding this comment

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

If you think this is going to grow, we might considering changing this in the future to something like

if (Object.keys(labels).filter(label => term.startsWith(label)).length > 0) {

Or something like that. No need to right now, just food for thought :)

@Iinh Iinh merged commit 5d6c830 into main Feb 20, 2024
7 checks passed
@Iinh Iinh deleted the filter-by-names branch February 20, 2024 16:25
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.

Probe queries can return apparently unrelated probes
2 participants