djangoproject.com icon indicating copy to clipboard operation
djangoproject.com copied to clipboard

Loading document 'body' from JSONField instead of filesystem

Open pauloxnet opened this issue 1 year ago • 2 comments

The body of a Document is loaded from a JSON file from the filesystem:

  • https://github.com/django/djangoproject.com/blob/main/docs/models.py#L356

As we already store the JSON file in metadata field in the Document:

  • https://github.com/django/djangoproject.com/blob/main/docs/models.py#L192

It would be better to load the body from the metadata

pauloxnet avatar Sep 26 '24 19:09 pauloxnet

Yep. The field already exists & is populated, and is also the source from which the full-text search gets its information, so it makes sense that it should be the sole source of truth.

I imagine this was the original goal when the JSONField was added to the Document model.

jacklinke avatar Oct 06 '24 19:10 jacklinke

My original goal when I added the JSONfield was only to be able to access all the information to create a full-text index. I was not so into the website code to know how the page load was working. I realized this only recently looking at the code for some improvement. At this point it would be better to upgrade the website to Django 5.1 so that we can use the GeneratedField to simplify this step

pauloxnet avatar Oct 07 '24 07:10 pauloxnet