Skip to content

Use extracted dartdoc texts in search. #1428

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

Merged
merged 2 commits into from
Jul 5, 2018
Merged

Conversation

isoos
Copy link
Collaborator

@isoos isoos commented Jul 3, 2018

@isoos isoos requested a review from sortie July 3, 2018 16:20
Copy link

@sortie sortie left a comment

Choose a reason for hiding this comment

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

lgtm

}).toList();
results.sort((a, b) => a.relativePath.compareTo(b.relativePath));
return results;
} catch (e, st) {
_logger.warning('Parsing dartdoc index.json failed.', e, st);
_logger.warning('Parsing pub-data.json failed.', e, st);
Copy link

Choose a reason for hiding this comment

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

If pub-data.json is made by us and not by users, then that sounds like an error to me (we'll certainly want to know about it). What makes this case plausible? The return null can be moved into the catch body.

Maybe the caller should have this try block instead of wrapping the whole function? This function also doesn't know the data came from 'pub-data.json'.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point, fixing both.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The parse error could happen if we change the format in a breaking way, and an older client reads the new format, or a newer client reads the old format, and they are not prepared for some kind of new structure.

final indexJsonFutures = Future.wait(packages.map((p) =>
dartdocClient.getContentBytes(p.name, 'latest', 'index.json',
final pubDataFutures = Future.wait(packages.map((p) =>
dartdocClient.getContentBytes(p.name, 'latest', 'pub-data.json',
Copy link

Choose a reason for hiding this comment

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

Does pub-data.json already exist?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Prod: not yet, but it will with the next release.

@isoos isoos merged commit 71fa552 into dart-lang:master Jul 5, 2018
@isoos isoos deleted the dartdoc_search branch July 5, 2018 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants