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

Search: refactor json parser #7184

Merged
merged 4 commits into from Jun 16, 2020
Merged

Search: refactor json parser #7184

merged 4 commits into from Jun 16, 2020

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Jun 11, 2020

  • Use classes
  • Get the code ready to index directly form html
  • Remove duplicated tests
  • Rename some functions/variables

Logic is the same

- Use classes
- Get the code ready to index directly form html
- Remove duplicated tests
- Rename some functions/variables

Logic is the same
@@ -1,32 +0,0 @@
import os
Copy link
Member Author

@stsewd stsewd Jun 11, 2020

Choose a reason for hiding this comment

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

We already have a more general tests in search/tests/test_parsers.py

@stsewd stsewd requested a review from a team Jun 11, 2020
Copy link
Member

@ericholscher ericholscher left a comment

This is a really solid refactor. 💯

parser_class = (
SphinxParser if self.version.is_sphinx_type else MkDocsParser
)
parser = parser_class(self.project, self.version)
Copy link
Member

@ericholscher ericholscher Jun 15, 2020

Choose a reason for hiding this comment

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

We likely only need a version here, since it already relates to project.

Copy link
Member Author

@stsewd stsewd Jun 15, 2020

Choose a reason for hiding this comment

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

I thought we were doing that for performance

project = models.ForeignKey(
'Project',
verbose_name=_('Project'),
related_name='imported_files',
on_delete=models.CASCADE,
)

But I think django will still do another query at least we are not doing a prefetch somewhere

- foo.rst
- foo/index.rst

Both lead to foo/index.html.
Copy link
Member

@ericholscher ericholscher Jun 15, 2020

Choose a reason for hiding this comment

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

This is a good docstring 👍

@stsewd stsewd merged commit 1523884 into master Jun 16, 2020
2 checks passed
@stsewd stsewd deleted the refactor-json-parser branch Jun 16, 2020
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.

None yet

2 participants