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

Draft: Add test filesection indexer #11791

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Draft: Add test filesection indexer #11791

wants to merge 3 commits into from

Conversation

ericholscher
Copy link
Member

@ericholscher ericholscher commented Nov 23, 2024

This is a test implementation of storing the section data in a similar way to filetreediff.

The goal would be to build a command pallette that initially lets users do some basic filtering of just the filenames.

Demo

Screen.Recording.2024-11-22.at.4.04.47.PM.mov

This is a test implementation of storing the section data in a similar way to filetreediff.

The goal would be to build a command pallette that initially lets users do some basic filtering of just the filenames.
@ericholscher ericholscher changed the title Add test filesection indexer Draft: Add test filesection indexer Nov 23, 2024
if not manifest:
return None

return {
Copy link
Member Author

Choose a reason for hiding this comment

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

Example in dev from Addons.

{
    "enabled": true,
    "sections": [
        {
            "path": "genindex.html",
            "sections": [
                {
                    "id": "index",
                    "title": "Index"
                }
            ]
        },
        {
            "path": "index.html",
            "sections": [
                {
                    "id": "read-the-docs-addons",
                    "title": "🦸 Read the Docs Addons"
                },
                {
                    "id": "examples",
                    "title": "Examples"
                },
                {
                    "id": "contents",
                    "title": "Contents"
                }
            ]
        },
        {
            "path": "releasing.html",
            "sections": [
                {
                    "id": "releasing",
                    "title": "Releasing"
                }
            ]
        },
        {
            "path": "search.html",
            "sections": [
                {
                    "id": "",
                    "title": "Search - Read the Docs Addons documentation"
                }
            ]
        },
        {
            "path": "testing.html",
            "sections": [
                {
                    "id": "testing",
                    "title": "Testing"
                },
                {
                    "id": "localhost",
                    "title": "localhost"
                },
                {
                    "id": "read-the-docs",
                    "title": "Read the Docs"
                }
            ]
        }
    ]
}

Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't return the content of manifest here, but instead, we should return the URL where the frontend would download it and parse it on the client side. Otherwise, this response will be huge and most of the times it's not going to be used.

Copy link
Member

@humitos humitos Nov 25, 2024

Choose a reason for hiding this comment

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

By the way, I think we will probably want to do the same for filetreediff as well; since there will be PRs will a ton of files changed.

Besides, that will help us to invalidate the cache for filetreediff when a new build is done, but keep cached the /_/addons/ endpoint for the whole project, as we are currently doing.

Copy link
Member Author

@ericholscher ericholscher Nov 25, 2024

Choose a reason for hiding this comment

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

Yea I just copied the implementation from filetreediff. I figured in production we would only pull the data when somebody pulls up the command pallet, but this made it easy to test.

In theory, the data is also already in our search index, I just wasn't 100% sure how to get it out of elastic.

Comment on lines +30 to +31
path=page["path"],
sections=[FileSection(**section) for section in page["sections"]],
Copy link
Member

@humitos humitos Nov 25, 2024

Choose a reason for hiding this comment

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

It probably makes sense to save the title of the page itself as well -- so we don't show release.html only but, Releasing Addons :: release.html or similar.

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