How Can I Search Unpublished Content?

dogboy72 - August 27, 2008 - 21:38

I have hundreds of unpublished nodes that I need to be able to find via the search function. Anyone know how?

> I have hundreds of

-Anti- - August 27, 2008 - 22:41

> I have hundreds of unpublished nodes that I need to be able to find via the search function

You mean for admin purposes? So you can publish some of them or perform another function on them?
Then, don't use search. Go: Admin > content management >content.
There is a filter to expose, select and batch process nodes; one of the filters is 'unpublished'.

Thanks, Yes, I am familiar

dogboy72 - August 27, 2008 - 23:06

Thanks, Yes, I am familiar with that. It is a fairly tedious way to find particular nodes though - I have 12 pages of unpublished nodes on the content list.

I am surprised there isn't a way for administrators to search ALL content.

Oh I see... what you're

-Anti- - August 27, 2008 - 23:20

Oh I see... what you're saying is that unpublished nodes aren't indexed by the drupal search.
Hmmmm.... I can see your point!

Indexing Unpublished Nodes For Admin Search?

dogboy72 - August 27, 2008 - 23:27

Exactly. I thought there would be a module that would modify search to do this - but if there is such a beast it is hiding very well.

Worst. Answer. Ever.

agaric - September 24, 2008 - 08:36

This is a proof of concept. Do not try this at home.

This is a hack to the core node module of Drupal 4.7. It is 4:30 a.m., I'm working with 4.7, and I'm hacking core. That should be all you need to know to start quietly backing away from your monitor.

That said, this patch at least identifies where the searching and indexing is restricted to published nodes... because it strips them out. Meaning that anonymous users, say, can see your unpublished content. Not good. But it would be fairly easy to create an "unpublished" tab for search that searches unpublished nodes, by reversing the logic.

If someone can search the core to see if this issue has come up, and post an issue and link to it here, I will try to get a patch into D7 that will index unpublished content and show it to searchers with proper permissions.

File attachments aren't allowed in forum comments, so those inclined can check it out on the Agaric Design site

benjamin, Agaric Design Collective

Views?

glennr - September 24, 2008 - 09:01

I agree, adding an unpublished option would be nice extra feature Drupal's advanced search. But if you're going to managing a lot of unpublished content fairly regularly, perhaps it might be worthwhile to set up your own admin views with Views? As you'd probably know, you can filter and sort content any number of ways, add views to a menu, etc. And this module can help with operations: http://drupal.org/project/views_bulk_operations.

Views doesn't really solve

Grayside - May 4, 2009 - 06:05

Views doesn't really solve the problem unless there is personally meaningful metadata to pivot on. Search has a role here.

Unfortunately, using Unpublished nodes in this way is kind of an abuse of the mechanism. If you want to treat them as first-class citizens, instead of citizens-on-deck, you need to set up an Access Control System. It sounds like tac/tac_lite for taxonomy-based access control would be a good way to go.

The conundrum in that case is taking the performance hit of access control just to make your own administrative policies work.

I would love to search unpublished nodes just so I can use my personal website as a private journal from which I could pull entries for public viewing. That seems unlikely. The hack mentioned above sounds like something Solr or LuceneAPI might be able to achieve.

The Deploy module is one of the coming solutions to this problem. It would allow you to set up a staging site of "unpublished" content, and use Deploy to push content across to another, public Drupal installation. At least as I read it.

Nice idea

glennr - May 4, 2009 - 11:55

Sure Views can solve the problem. I've set up an admin system using Views, with exposed filters allowing me to really drill down into the content with dropdown lists for unpublished/published, taxonomy, node type, etc. Very powerful, especially when used with Views Bulk Operations. It's also a great way to give less technical content editors access to a content admin system without giving them full "administer nodes" permission.

But it's certainly not the only solution. There are other modules, such as Workflow, Modr8, Draft and others, that are worth a look. But it'd be great to be able search unpublished nodes too, and I like your idea of using a content access module like Taxonomy Access Control Lite. Create a simple public/private taxonomy and restrict access to private nodes. For your purpose, I don't think this is a hack -- isn't this what content access modules are designed for? And sure there might be some performance hit, but would it really be a noticeable hit on typical sites?

TAC_lite will probably end up

Grayside - May 4, 2009 - 19:53

TAC_lite will probably end up being my approach. Minor Performance + Maintenance Time is where the only concern really comes in. My real performance concern is about 90% learning & experimentation, so it's not an instance that has much bearing on this conversation.

Undoubtedly any search mechanism for unpublished nodes will also be a major maintenance sink, but if someone is going to use extended search resources anyway, it's a worthwhile conversation.

And like I said about Views, plenty of data is exposed, but you need to know what you want to pivot on. Search provides the fuzzy "something like X" functionality that is sometimes needed. Moderation queues require skimming. I'm imagining the above poster's use case is something like a magazine in which many, many articles have no specific deadline beyond "topical, complete, and approved".

 
 

Drupal is a registered trademark of Dries Buytaert.