I need help with a simple Browser query


I created a parent tag named Hyperskill. There are several children tags under the Hyperskill tag, like:

  • Hyperskill::constructors
  • Hyperskill::accessModifiers

My database has notes that simply contain the tag “Hyperskill” without any children tag.

How can I make a query to select the cards that have the Hyperskill tag, excluding all of its children tags?

Just type tag:Hyperskill:: .

If you want to see all the children tags you would need to write tag:Hyperskil::*.

Unfortunately, this query selects all notes that contains the Hyperskill tag, including all of its children tags.

For instance, the query tag:Hyperskill also selects notes with these tags:

  • tag:Hyperskill::constructors
  • tag:Hyperskill::accessModifiers::protected

I want to be able to select notes with the tag Hyperskill excluding any notes that contain children tags such as Hyperskill::constructors

Using tag:Hyperskill:: instead of tag:Hyperskill doesn’t seem to work either

Sorry, you are correct and my previous reply is not working and I don’t know of a way to do it from the browser search. Hopefully, someone will come up with a better response.

In the meantime, in case it is useful for you, I had a similar problem a few days ago with having parent tags with the same name as standalone tags.

You can find those tags from the Notes - Find and replace menu, searching in Tags and treating input as a regular expression you can search for Hyperskill$ and replace the tag with something else.

Sorry I can’t be of more help.

1 Like

Thank you!

This method, works, despite being slightly tedious.

Now, I think that this issue can be a result of starting to create cards about a certain topic, without yet figuring out how to organize the whole hierarchy of tags.
This is likely an issue that occurs more often than not. After all, when someone begins to study something, they don’t know how to classify every card with full precision. And that’s what can create a mess with tags.

For instance, when I started to learn Java in Hyperskill, I didn’t know how to exactly classify the tag of every card that I was creating, so I just gave my cards a generic tag named Hyperskill. As I kept studying the material and creating more cards, I began to have a feeling on how to structure my tag hirearchy.

However, a problem can occur where you have a lot cards with well structured tags mixed with cards with poorly structured tags.

Here is an example on how to fix this
Let’s say that I want to start learning how to code.
I might start creating some cards, but I’m not really sure how to classify my cards with full precision yet, so I’ll simply assign them a general tag Coding
Then, as I continue learning, and creating more cards, I’ll create tags with more specific values like Coding::HTML::tables, Coding::Java::Methods::Static, etc:

Now we want to apply a proper tag to those cards that only have a Coding tag.

Step 1. Select all notes by applying this query: tag:Coding

Step 2. Using the Find and Replace tool, we will create a temporary tag where we will store cards with a Coding (and nothing else) tag.

Step 3: Now, every card with a Coding tag will have been replaced. Select the cards with the temporary tag and apply a new proper tag to these cards. Once you are finished, delete the temporary tag.

Doing this would be a lot more convenient if we could simply perform one query to only select the cards with a parent tag, but I’m glad to find a solution that worked :slight_smile:

I’ll wait a few more days to see whether somebody knows how to solve this problem with a query.

Glad you could solve it!

1 Like

I figured out the right query:

tag:ParentTag -tag:ParentTag::*
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.