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(algolia): index explorer views to Algolia #3428

Merged
merged 8 commits into from
Apr 11, 2024

Conversation

marcelgerber
Copy link
Member

@marcelgerber marcelgerber commented Mar 29, 2024

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:

  • 7-day pageviews of the whole explorer
  • Number of explorer settings that differ from the default
  • Length of title

These are then combined into the rather-arbitrary-but-seemingly-working-quite well

score = explorerPageviews * 10 - numNonDefaultSettings * 50 - titleLength

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

  • Change configureAlgolia:
  • Compute and index viewTitleIndexWithinExplorer
  • Index numViewsWithinExplorer
  • Strip out Markdown syntax, like DoDs
  • Get rid of indexExplorersToAlgolia, it's superseded (-> will do this in future cleanup PR)

Copy link
Member Author

marcelgerber commented Mar 29, 2024

@ikesau
Copy link
Member

ikesau commented Mar 29, 2024

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 🦥

@marcelgerber marcelgerber mentioned this pull request Apr 2, 2024
@marcelgerber
Copy link
Member Author

marcelgerber commented Apr 2, 2024

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?)

Hey - I commented directly on #3431 (comment).

@marcelgerber marcelgerber marked this pull request as ready for review April 4, 2024 14:30
@marcelgerber marcelgerber requested a review from ikesau April 5, 2024 11:38
Comment on lines +111 to +124
// 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])
)
})
Copy link
Member

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)",
Copy link
Member

Choose a reason for hiding this comment

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

really like this solution 🙂

@marcelgerber marcelgerber merged commit f364c91 into master Apr 11, 2024
32 checks passed
@marcelgerber marcelgerber deleted the search-explorer-indexing branch April 11, 2024 15:06
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.

Discover: add explorer views into search index
2 participants