-
-
Notifications
You must be signed in to change notification settings - Fork 229
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(algolia): index explorer views to Algolia #3428
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @marcelgerber and the rest of your teammates on Graphite |
Hey @marcelgerber - is there a way to, as part of your efforts here, write/extract a function that returns all non-grapher Explorer views? (Or do we already have such a function?) We'd like to include that count in the sum on the homepage under the search bar. I'm happy to write it myself if it doesn't already exist, but it seems like the sort of thing this PR might need too, and I don't want to do any redundant work 🦥 |
Hey - I commented directly on #3431 (comment). |
945fe68
to
a949af3
Compare
546e78c
to
f988fdc
Compare
d2dffb9
to
7dbbc49
Compare
// Check which choices are non-default, i.e. are not the first available option in a dropdown/radio | ||
const nonDefaultSettings = Object.entries( | ||
explorerDecisionMatrix.availableChoiceOptions | ||
).filter(([choiceName, choiceOptions]) => { | ||
// Keep only choices which are not the default, which is: | ||
// - either the options marked as `default` in the decision matrix | ||
// - or the first available option in the decision matrix | ||
return ( | ||
choiceOptions.length > 1 && | ||
!(defaultSettings[choiceName] !== undefined | ||
? defaultSettings[choiceName] === choice[choiceName] | ||
: choice[choiceName] === choiceOptions[0]) | ||
) | ||
}) |
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.
grokking this took a while as I'm unfamiliar with explorer "choice" terminology but inspecting a few examples I see what you mean now 🙂
customRanking: [ | ||
// For multiple explorer views with the same title, we want to avoid surfacing duplicates. | ||
// So, rank a result with viewTitleIndexWithinExplorer=0 way more highly than one with 1, 2, etc. | ||
"asc(viewTitleIndexWithinExplorer)", |
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.
really like this solution 🙂
Resolves #3332.
Staging environment
This PR doesn't have its own Algolia staging environment, but instead you can look at the ones for the upstack PR #3429:
search-explorer-indexing-algolia
Ranking
Ranking criteria being used:
These are then combined into the rather-arbitrary-but-seemingly-working-quite well
Note that
explorerPageviews
doesn't change between different views of the same explorers; so it's only used to discriminate results from different explorers.TODOs
configureAlgolia
:distinct: 4
byexplorerSlug
viewTitleIndexWithinExplorer
removeWordsIfNoResults
viewTitleIndexWithinExplorer
numViewsWithinExplorer
indexExplorersToAlgolia
, it's superseded (-> will do this in future cleanup PR)