Now that #306224: EOL Taxonomy sprint: add proper taxonomy term hooks allows modules to add data to the term object upon load, a lot of functions in taxonomy module which do their own queries of the term_data table will be returning incomplete term objects if such a module is installed (in some cases this seems to be more or less by design, but it's very inconsistent) - additionally, if more than one of those functions runs on the same page request, they duplicate queries unnecessarily.

The one function we have which loads of real terms itself (taxonomy_get_tree) only does so because it has to run recursive queries to get them. We can't fix that with this patch, but there's plans to store the taxonomy tree as materialised path/nested sets which would hopefully allow both to work in conjunction.

I'm working on #324313: Load multiple nodes and terms at once - this patch does the same thing for taxonomy terms, allowing you to load full term objects from an array of tids, or by condition (name, vid). taxonomy_term_load() becomes a wrapper for this function to avoid code duplication and share the same cache. So far I've done these bits, and confirmed that all tests work. I'm going to look into converting some of the other taxonomy functions to use this next so we can see how much difference it makes.

CommentFileSizeAuthor
#2 term_multiple_load.patch4.97 KBcatch
term_multiple_load.patch3.16 KBcatch

Comments

keith.smith’s picture

If/when you have to reroll, can you adjust:

+ * Whether the reset the internal cache.

catch’s picture

StatusFileSize
new4.97 KB

Converted taxonomy_nodeapi_load() to use this - patch now depends on #324313: Load multiple nodes and terms at once otherwise the nodeapi tests will fail.

catch’s picture

Status: Needs review » Closed (duplicate)

Marking as duplicate of the nodes patch since these are too closely linked to do in one go.