Tags curinga em buscas - encontrar tópicos sem certas tags?

Tenho a seguinte situação:

Tenho uma categoria contendo muitos tópicos (mais de 900), todos com a mesma tag, digamos respondido, que usamos para acompanhar as postagens que receberam resposta.

Muitos também contêm outras tags: implantação, cli, api, e assim por diante, para denotar o “tema” da pergunta.

Como posso encontrar todos os tópicos na minha categoria que possuem apenas a tag respondido, mas nenhuma das outras?

Já tentei a seguinte sintaxe, por exemplo tags:respondido -tags:redirecionamentos ao pesquisar, o que realmente me dá todas as coisas com a tag respondido, mas NÃO aquelas com a tag redirecionamentos.

Mas para aplicar isso à minha situação, teria que listar todas as tags que NÃO quero encontrar individualmente — e tenho muitas.

Existe uma maneira de usar curingas nas buscas por tags? Algo como: tags:respondido -tags: *?

Se não, existe outra maneira de obter uma lista de coisas que possuem APENAS a tag respondido e nenhuma das outras?

Obrigado pelas suas reflexões sobre isso.

This is the only way I can see of excluding tags from a search.

It is possible to search for tag groups by using the category modifier with the tag group’s slug. For example, if you had a tag group called ‘topic status’, you can search for its tags with #topic-status, but tags can’t be excluded in this way, so -#topic-status doesn’t work.

1 curtida

Thanks @simon - I think I’ll try adding all the tags I don’t want to search for to a tag group as suggested, and try that :muscle:

Sorry, I wasn’t as clear as I could have been. If it was possible to exclude a tag group from search, this approach would work, but I can’t see any way to exclude a tag group from search results.

2 curtidas

oh, i misunderstood. So its not possible - at all?

You could get a list of topics that only have a single given tag with a Data Explorer query. Something like this might work for you:

--[params]
-- string :tag_name

with tagged_topics AS (
SELECT 
topic_id
FROM topic_tags
JOIN tags
ON tags.id = topic_tags.tag_id
WHERE tags.name = :tag_name
),
counts AS (
SELECT
COUNT(id) AS tag_count,
tagged_topics.topic_id
FROM topic_tags
JOIN tagged_topics
ON tagged_topics.topic_id = topic_tags.topic_id
GROUP BY tagged_topics.topic_id
)

SELECT
c.topic_id
FROM counts c
JOIN topics t
ON t.id = c.topic_id
WHERE t.deleted_at IS NULL
AND t.archetype = 'regular'
AND c.tag_count = 1
1 curtida