Skip to content

Conversation

@colby-swandale
Copy link
Member

We shouldn't create links to objects which the documentation refers to, but we don't have a page for

Resolves #481

@natematykiewicz
Copy link
Contributor

natematykiewicz commented Aug 18, 2021

What’s the perf on this like? Because it looks like it’s going to do N queries. I guess since it’s just the modules/classes it won’t be that many queries…

@natematykiewicz
Copy link
Contributor

natematykiewicz commented Aug 18, 2021

It looks like this is loading up the entire documentation for the parent class and each included module.

So viewing https://rubyapi.org/3.0/o/stringio, will ask ElasticSearch for the documentation of the entire StringIO, Object, Enumerable, IO::generic_readable, and IO::generic_writable objects.

I'm not very familiar with ElasticSearch, but if I were doing this in SQL, I'd do something like this:

objects = [@object.superclass] + @object.included_modules
object_names = objects.compact.map(&:name)

existent_object_names = 'SELECT name FROM ruby_objects WHERE ruby_version = ? AND name IN (?)'

Do that query once for the request, and then you can simply check whether the superclass or included module's name is in the list of ones that actually exist in the database.

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.

Tempfile parent class 404

3 participants