What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

Is there any way to search for questions that have a specific tag and only that lonely tag?

In other words, I'd like to be able to do something like the following to find questions that have a single tag and no other:

[mytag] tagcount:1

This would be very useful for tag cleanup situations to be able to do house-cleaning before nuking a tag.

share|improve this question
1  
Turned into a feature request. –  Shadow Wizard Jan 29 at 8:38

2 Answers 2

This query might help...

http://data.stackexchange.com/programmers/query/81422

It is specifically for Programmers but you can use it to search for questions with only a specific tag.

share|improve this answer
1  
That's awesome, but the data explorer doesn't include beta sites! –  Caleb Oct 1 '12 at 13:19
    
@Caleb Yeah and the information is generally not updated frequently, as this is not production data. It is really only useful if you were curious for analytical reasons. –  maple_shaft Oct 1 '12 at 13:22
1  
I'm trying to do tag cleanup, so it would be nice it was actually live data so I could see progress as I re-tag things. +1 for a tangentially helpful bit though. –  Caleb Oct 1 '12 at 13:23
    
Also, welcome to Meta.SO! I feel honored to catch your first post ;) –  Caleb Oct 1 '12 at 13:23
    
@Caleb Thanks for the welcome! Been lurking for a while, don't feel compelled to discuss things often. –  maple_shaft Oct 1 '12 at 13:30
3  
@Caleb it include beta sites now. Enjoy! –  Shadow Wizard Jan 29 at 8:38

Using the API, you can find all questions that have a certain tag, then filter out the ones that have more than one tag. Here is a demonstration that searches for questions tagged solely with on Bicycles:

var tag = "puncture";
var site = "bicycles";

var url = 'http://api.stackexchange.com/2.1/questions?sort=activity&callback=?';

var h3 = $('h3 span');

// Retrieve data
(function gather(cp, object) {
    if (typeof object === "undefined" || object.has_more) {
        $.getJSON(url, {
            site: site,
            tagged: tag,
            page: ++cp,
            key: "awn3X8U)9erzSfhBhqSF4A((",
            filter: "!BGS1(RNaQD-DYnwoUQeh2eZDaLm__P"
        }, function (data) {
            h3.html("(" + cp + " pages)")
            if (object) {
                data.items = data.items.concat(object.items);
            }
            gather(cp, data);
        });
    } else {
        display(object);
    }
})(0)

// Display data
function display(data) {
    var data = data.items;
    data = data.filter(function (v, i, A) {
        return v.tags.length == 1;
    });
    $.each(data, function (i, v) {
        var li = $('<li/>');
        var a = $('<a/>').attr('href', this.link).text(this.title);
        $('#results').append(li.append(a));
    });
    var heading = $('<h3/>').html('Total: ' + data.length);
    $('#results').prev().replaceWith(heading);
}
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .