algolia / algolia/docsearch-scraper
Add content snippet for lvl-n heading match
- Dominant language
- Python
- Stars
- 322
- Forks
- 115
- PR merge metrics
- No merged PRs in 30d
Description
When a query matches a heading, the snippet result is empty. For example, search for "queryHook" in docsearch's own documentation: https://docsearch.algolia.com/search?q=queryHook Now compare that to the search for "queries algolia": https://docsearch.algolia.com/search?q=queries+algolia
The lack of any sort of content preview in the suggestion from the first example makes it seem less relevant than a suggestion that includes a snippet result. I think the user (myself included) expects to see some sort of context.
Perhaps the scraper can take the first several words below a heading and store those in the content. Another solution would be to allow the config to match a description for the page, which could then be used in the attributesToSnippet as a fallback. (I realize I could also populate the description using a meta tag). However, the description for the page might come across as too generic for a heading further down. A snippet taken from the content below the heading would make much more sense.
Contributor guide
Research direction
Start by tracing how the scraper handles headings and populates the content used by attributesToSnippet. Compare the empty snippet for a heading match with the existing page-description or content behavior described in the issue. Done means heading-level results show useful context without making unrelated page descriptions misleading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100