Jump to content

Search notes with specified tags but no others


Recommended Posts

  • Level 5*
21 hours ago, mstankus said:

I would like to be able to search for notes which have exactly 2 tags and those tags are A and B, for instance.

It would not match notes which have tags A, B and C, for instance.

I can do a search for tag:A tag:B
The only way I can see of excluding other tags is to use top list view on my Mac and sort on the tag column
Your exclusive A/B notes will be listed at the top.  
You could apply a temporary tag to identify them


Screen Shot 2016-06-05 at 1.08.54 PM.png

Edit:  As JM pointed out; A/B may not sort to the top or together.  You can make a temporary change to force the sort order.  For example: Change A to "-A" and B to  "-B"

Link to post
  • Level 5*

Only way I know is to add -tag:othertag to the search for any other tags that are in the notes tagged with both A and B.  Not too much of a PITA if the other tags are a small group. 

Link to post
  • Level 5*
7 hours ago, DTLow said:

The only way I can see of excluding other tags is to use top list view and sort on the tag column
Your exclusive A/B notes will be listed at the top.

Not necessarily at the top.  They would be at the top ONLY if there were no other Notes with tags whose sort order is above the tags of interest.

So, if you wanted notes with tags "M", and "N", those notes with tags of "D", "M","N" would sort ABOVE the Notes with only "M", "N".

8 hours ago, mstankus said:

I would like to be able to search for notes which have exactly 2 tags and those tags are A and B, for instance.

It would not match notes which have tags A, B and C, for instance.

@mstankus:

The only approach that would work is if you can explicitly exclude all of the other tags, like this:
tag:A tag:B -tag:C -tag:D  . . .

One workaround to this is if all of the other tags have the same prefix, like "SYM."
tag:A tag:B -tag:SYM.*

 

Link to post
  • Level 5*
8 minutes ago, JMichaelTX said:

Not necessarily at the top.  They would be at the top ONLY if there were no other Notes with tags whose sort order is above the tags of interest.

So, if you wanted notes with tags "M", and "N", those notes with tags of "D", "M","N" would sort ABOVE the Notes with only "M", "N".

That's true, but my approach would be to make a temporary change to force the sort order

For example, M becomes "-M" an N becomes "-N"

Link to post
  • Level 5*
23 minutes ago, DTLow said:

That's true, but my approach would be to make a temporary change to force the sort order

For example, M becomes "-M" an N becomes "-N"

I see you made an edit to your post after I made my post, to add your tag rename strategy.

IMO, it is NOT a practical solution, in fact, it's a bad idea.  Changing a Tag name is NOT trivial, and in fact, if you a lot of tags, can be quite time consuming.  Furthermore, the change could sync to other devices, causing more problems. And, of course, then you have to make the change back.  

Still not easy, but more practical, is to simply scroll down the filtered note list until you find the block of Note with only the tags of interest.

Link to post
  • Level 5*
On June 5, 2016 at 9:25 PM, JMichaelTX said:

The only approach that would work is if you can explicitly exclude all of the other tags, like this:
tag:A tag:B -tag:C -tag:D  . . .

One workaround to this is if all of the other tags have the same prefix, like "SYM."
tag:A tag:B -tag:SYM.*

This actually works for me since all my tags have a prefix of !/?/@/. corresponding to my !What/?Who/?Where/.When classifications.

I'd still have to temporarily rename the two tags to isolate them

On June 5, 2016 at 10:08 PM, JMichaelTX said:

IMO, it is NOT a practical solution, in fact, it's a bad idea.  Changing a Tag name is NOT trivial, and in fact, if you a lot of tags, can be quite time consuming.

I'm not seeing your reasoning.  
It is a simple task to temporarily rename the two tags
My understanding is that no notes are updated; just the name assigned to a tag id

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...