Drupal: Finding Uncategorized Nodes

If you're working with a site with a lot of nodes, especially nodes that have been migrated out of another CMS or blogging tool, you'll probably find yourself wondering which nodes are floating around without any taxonomy terms, so that you can go back and make sure they're duly categorized.

Getting a raw list of node ID's and titles is simple with the following SQL query, which you can execute from the MySQL command line client, or PHPMyAdmin (which your web host's admin panel probably provides):


SELECT nid, title FROM `node` n WHERE n.nid NOT IN (SELECT DISTINCT nid FROM `term_node`);

From there you can just go to your browser and start plugging in edit urls: `http://mysite.com/node/123/edit`, `http://mysite.com/node/456/edit`, et cetera.

If you have a large number of uncategorized nodes, it may be worth writing a module to find and/or categorize them automatically.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Since nodes may be

Since nodes may be categorized with more than one term, the inner select will return duplicates: you probably want to "SELECT DISTINCT nid FROM term_node".

You're right, thanks!

I've updated the query accordingly.

Alternate result: SELECT

Alternate result:


SELECT n.nid FROM node n LEFT JOIN term_node tn ON n.nid = tn.nid GROUP BY n.nid HAVING count(tn.tid) = 0;

pp

Thanks for this trick. It

Thanks for this trick.
It could be nice to have such thing realized as module.

Node Search

Basic but useful post . Thanks

Nodes

In communication networks, a node (Latin nodus, ‘knot’) is a connection point, either a redistribution point or a communication endpoint (some terminal equipment). The definition of a node depends on the network and protocol layer referred to. A physical network node is an active electronic device that is attached to a network, ccnp exams, and is capable of sending, receiving, or forwarding information over a communications channel. A passive distribution point such as a distribution frame is consequently not a node.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><p><div> <br><img>
  • Lines and paragraphs break automatically.

More information about formatting options

Verification
This question is for testing whether you are a human visitor and to prevent automated spam submissions.