Jump to content

Creating query to find notes without specific tags


Recommended Posts

I have tags - Q1,Q2,Q3 and Q4. I would like to find any notes that do not have at least one of these tags.

 

I have tried: any: -tag:Q1 -tag:Q2 -tag:Q3 - tag:Q4

 

but this doesn't work.

 

I have tried same with -any: at the beginning.

 

I have tried tag:-Q1 tag:-Q2 tag:-Q3 tag:-Q4

 

and with any: at the beginning.

 

Grateful for any help.

 

thanks

 

Link to comment
  • Level 5*

I have tags - Q1,Q2,Q3 and Q4. I would like to find any notes that do not have at least one of these tags.

 

I have tried: any: -tag:Q1 -tag:Q2 -tag:Q3 - tag:Q4

 

but this doesn't work.

 

I have tried same with -any: at the beginning.

 

I have tried tag:-Q1 tag:-Q2 tag:-Q3 tag:-Q4

 

and with any: at the beginning.

 

Grateful for any help.

 

thanks

If I understand this correctly, then a search on -tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 should work. Let's break it down.

 

I would like to find any notes that do not have at least one of these tags

I translate this as "find all notes that have none of these tags". That's a little tricky to express right away, so let's go for something easier and related. Let's find all of the notes that do have at least one of those tags. In logic terms we'd write something like: tag:Q1 OR tag:Q2 OR tag:Q3 OR tag:Q4. Translating to Evernote's search language, we'd get: any: tag:Q1 tag:Q2 tag:Q3 tag:Q4. That's the opposite of what we really want, but bear with me.

The opposite of the above is easy ti express in logic terms: NOT (tag:Q1 OR tag:Q2 OR tag:Q3 OR tag:Q4). We can't express that directly in Evernote-ese, so let's manipulate it a bit. By DeMorgan's Law (you can look it up), the previous statement translates as: (NOT(tag:Q1) AND NOT(tag:Q2) AND NOT(tag:Q3) AND NOT(tag:Q4)), and that, in Evernote's search language is: -tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4

I haven't tried it out, but I think that you may have gotten the syntax a bit wrong, if what you tried is what you wrote above. Give my version a try. If it doesn't work, I'll rig up a test on my account; you should be able to do this search, is my guess.

Link to comment

I have tags - Q1,Q2,Q3 and Q4. I would like to find any notes that do not have at least one of these tags.

I have tried: any: -tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4

but this doesn't work.

I have tried same with -any: at the beginning.

I have tried tag:-Q1 tag:-Q2 tag:-Q3 tag:-Q4

and with any: at the beginning.

Grateful for any help.

thanks

IME, you should be able to use the search grammar of:

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4

However, if your tag names have spaces, the tag names must be enclosed in quotes. IE:

-tag:"Q 1"

Link to comment

Please note in your original post, you had:

- tag:Q4 (space after hyphen)

When it should have been

-tag:Q4 (no space after hyphen)

This may simply be a typo in your post. But if you copied/pasted from your search, that would be a problem.

Link to comment
  • Level 5*

I'd take the clarification, too. But my reasoning: the request is for: "to find any notes that do not have at least one of these tags."

 

Since search is generally to find the set of notes meeting the criteria, rather than to find an exemplar of the criterion. I guessed and substituted 'all' for 'any'. So that changes the query to "find all notes that do not have at least one of these tags". That partitions the set into the notes that have at least one of the tags and those that do not. Finding the former is easy, Finding the opposite fell out of that.

 

I'm also guessing that Q1, Q2, etc. are stand-ins for first quarter, second quarter, etc., and further, happyatom is interested in finding any notes without a quarterly designation tag. 

 

I could be wrong... :)

Link to comment
  • Level 5*

I have tags - Q1,Q2,Q3 and Q4. I would like to find any notes that do not have at least one of these tags.

 

I have tried: any: -tag:Q1 -tag:Q2 -tag:Q3 - tag:Q4

 

but this doesn't work.

 

 

I don't think this can be done.  There might be a work-around IF all of your tags of interest actually start with "Q" (or any other common string) AND none of your other tags start with the same string:

 

-tag:Q*

 

To make this more bullet proof, you could rename your "Q" tags to have a common, but unique, prefix, like "QUES."

So then each tag would be "QUES.Q1", "QUES.Q2" etc

 

Now your search expression would be:  -tag:QUES.*

 

Please let us know if this works for you.

Link to comment

Hi - thanks for all your suggestions - sorry for the lack of clarity, but you did guess my intention. Q1 etc does stand for Quarter 1 etc and I want to find any notes that have not been tagged with a quarter.

 

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 as suggested by Jeff, returns all the notes because it is an 'AND' query and no records are tagged with all of them.

 

The only suggestion that works is -tag:Q* from JMichael. Unfortunately I was only giving part of my issue. I also have tags for week, month and day. My objective is to find any notes that do not have a time tag - so it means combining -tag:Q* with -tag:day, -tag:month, -tag:week. The result of the query should be - any records that do not have any of these tags.

 

But I think JMichael may be right that combining terms in this way can't be done

 

However, in this case I will just start all time tags with '+' - so I can can use JMichael's wildcard approach.

 

Thanks all again.

 

Paul

Link to comment
  • Level 5

Here are a couple workarounds - one might work for this unusual request or it might not work.

 

Your follow-up post #8 to include / exclude tags for day and month indicate you might not be using Evernote for it's best potential.  Why would you want to create and search for a tag for March (the month) and a tag for 25 (the day)? It sounds like you are trying to create a GTD type application.

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1.) My method

Individual tags for the week number, the month, and the day seems overly complicated. Personally, I might keep the Quarters tag, but would stop using all those other time related tags. If I worked in an accounting department, I might keep the week number tag, if it was used on a regular basis.

 

I prefer titles that contain a yymmdd date code in the title (as a prefix) rather than rely on a whole bunch of date tags.

Title example: 20140325 Blah Blah Blah

 

The intitle: search command is very powerful for finding notes that have this prefix.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

2.) A possible workaround for your current setup.

 

Evernote makes it very, very easy to add a new tag to a group of notes at one time. (bulk add)

 

If you need to maintain all those different date tags, you could clean up your database by tagging all those notes with a master tag (Fiscal for example). This master tag would apply to all the date tagged notes. This would be a one-time process.

 

From then on, the Fiscal tag needs to be included on all appropriate new notes..

 

So, to answer your original request: "Creating query to find notes without specific tags" would end up being changed to "Creating query to find notes without a specific tag"

You could run a query for -tag:Fiscal

Link to comment

Hi - thanks JBenson2 for the comprehensive reply.

 

There is method in my madness - really! In fact, I have changed from Q1 etc to Months. I also found that the '+' at the beginning of a tag name produced the right result but seemed to duplicate the tag name. I have therefore use 't-' at the beginning of all time-based tags and this works perfectly.

 

It is a GTD style approach but I don't like the concept of "Someday", "Next Week" because in my experience these are just buckets in which stuff gets left. Plus, what is 'Next Week' changes as time progresses. Therefore there is a tag for each day of the week and (as with 43 folders approach) this is a rolling week. Today is Tues so all tasks tagged Tuesday are for today. Tomorrow, tasks tagged Tuesday are for 6 days hence. In this way I can plan my week on a rolling basis. To find all the tasks for today, I just filter on the Tues tag.

 

As tasks are added they can be tagged as appropriate - either for a day in the coming week or one of the months. I Know finance work with Week numbers, but I don't - plus, as you said, a tag for each week is a lot of tags - months is a compromise.

 

At the beginning of each week (Monday for me), I would review any with this month's tags. This short range review helps me to keep in mind the big picture. Any tasks that can be completed in the coming week are then tagged with the specific day. Any tasks that don't get done on a day are retagged - mouse click and a drag; very quick.

 

This may seem like a lot of tagging but as you point out, it is very easy to bulk tag. Once a task is complete it is moved out of the Actions stack (notebook for each focus area) into a Completed Notebook - so these tasks are archived but don't show up in queries of live actions.

 

There are also tags groups for Who, Where and Importance. Plus, if I have a lot of tasks to complete in a day I can add an additional Priority tag - 1-4. Again, easy to bulk tag. Then untag at end of the day.

 

I will share the full system here once I have finished it - any other suggestions welcomed.

Link to comment
  • Level 5*

Hi - thanks for all your suggestions - sorry for the lack of clarity, but you did guess my intention. Q1 etc does stand for Quarter 1 etc and I want to find any notes that have not been tagged with a quarter.

 

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 as suggested by Jeff, returns all the notes because it is an 'AND' query and no records are tagged with all of them.

Just a note: the term -tag:X returns notes *not* tagged with 'X'. So my query would be to find all notes not tagged with Q1, and not tagged with Q2, etc.

I'll see if I can work up a test case for your situation later on.

Link to comment

Hi - thanks for all your suggestions - sorry for the lack of clarity, but you did guess my intention. Q1 etc does stand for Quarter 1 etc and I want to find any notes that have not been tagged with a quarter.

 

I have tags - Q1,Q2,Q3 and Q4. I would like to find any notes that do not have at least one of these tags.

I have tried: any: -tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4

but this doesn't work.

I have tried same with -any: at the beginning.

I have tried tag:-Q1 tag:-Q2 tag:-Q3 tag:-Q4

and with any: at the beginning.

Grateful for any help.

thanks

IME, you should be able to use the search grammar of:

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4

However, if your tag names have spaces, the tag names must be enclosed in quotes. IE:

-tag:"Q 1"

 

The above search finds all notes that are not tagged with any of the tags you mentioned.  (Q1, Q2, Q3, Q4)  Any note that has at least one of those tags will not show up in the results pane.  The problem with using -tag:q* is that it will not include any notes that are tagged with any other tag beginning with Q.  IOW, if a note has only one tag & that tag is "quarterly reports", it will not show up in the results pane.

Link to comment

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 as suggested by Jeff, returns all the notes because it is an 'AND' query and no records are tagged with all of them.

Technically, there is not an AND search in Evernote.  (Technically wrt the search grammar),  It's ALL or ANY.  You would want this to be an ALL search, which you can toggle from ANY. IOW, the note must meet ALL criteria.  A note with only one tag of Q3 is not displayed in the results pane b/c it does not meet ALL criteria, since it does not meet the criteria of -tag:q3.  It's very easy to test yourself.  Start out with only -tag:q1.  See what notes are displayed.  Then add -tag:q2 & see what notes are removed from the results pane.  Then add -tag:q3 to the search, etc, etc, etc. 

Link to comment

Thanks BurgersNFries; I think thinking "ALL or ANY" helps.

 

I got round the limitation of Q* getting all the tags beginning with Q by going for Q-1, Q-2 etc. So now query is -tag:Q-*. And this is working (though have now switched away from Q (quarters) to months and days of the week).

Link to comment
  • Level 5*

To be clear, TECHNICALLY an "AND" search and an "ALL" search are the same thing.  "ALL" means to logically combine all Search terms with a logical AND.

 

"ANY" means to combine all Search terms with a logical OR.

Link to comment
  • Level 5*

 

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 as suggested by Jeff, returns all the notes because it is an 'AND' query and no records are tagged with all of them.

Technically, there is not an AND search in Evernote.  (Technically wrt the search grammar),  It's ALL or ANY.  You would want this to be an ALL search, which you can toggle from ANY. IOW, the note must meet ALL criteria.  A note with only one tag of Q3 is not displayed in the results pane b/c it does not meet ALL criteria, since it does not meet the criteria of -tag:q3.  It's very easy to test yourself.  Start out with only -tag:q1.  See what notes are displayed.  Then add -tag:q2 & see what notes are removed from the results pane.  Then add -tag:q3 to the search, etc, etc, etc.

 

Wait, what? Technically, and logically speaking, an ALL search in Evernote, is exactly equivalent to a search where all of its terms are ANDed together, while an ANY search is exactly equivalent to a search where all if its terms are ORed together. Relevant quote from the Search Grammar doc:

"By default, the search results are the intersection of the notes that match each individual search term. This behavior changes if the "any:" modifier is found in the search. In this case, the search is executed as a union of the matches of the individual terms, and notes will be returned that match any of the criteria terms. The results are obviously identical if there is only one search term."

 

"Intersection" just means logical AND and "union" means logical OR. The search grammar doesn't explicitly express the ANDs or ORs, it just denotes that the search is one or the other by using the absence or presence of the "any:" modifier.

 

Must be too early on West Coast time for this stuff; better hit up the cappuchino machine for another dose!!

Link to comment
  • Level 5*

Hi - thanks for all your suggestions - sorry for the lack of clarity, but you did guess my intention. Q1 etc does stand for Quarter 1 etc and I want to find any notes that have not been tagged with a quarter.

 

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 as suggested by Jeff, returns all the notes because it is an 'AND' query and no records are tagged with all of them.

So I did work up a test case, and the search that I suggested originally does work as I expected (which, I think, matches what you were trying to do). I tagged four notes in a test notebook, one each with Q1, Q2, etc. A search on "-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4" returned every note in the notebook except for those four notes. Every time I tagged another note in that notebook with one of the 'Q' tags, it dropped out. The search found notes that were not tagged with any of the quarterly tags. Not sure why it didn't work for you.

The searches with wildcards are also fine; any wildcard introduces an OR term to the search, so you can sometimes shorthand listing all of the known items you're interested in with a wildcard, so long as the items have a common prefix (e.g. 'Q') and no other items use that prefix. It's the only way that I know of to do mixed AND/OR filtering in Evernote, though it's somewhat constrained; you generally need to contrive your tag name space to do this sort of thing. Oh, and the technique does work for general search terms (and intitle: terms, I think).

Link to comment

 

 

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 as suggested by Jeff, returns all the notes because it is an 'AND' query and no records are tagged with all of them.

Technically, there is not an AND search in Evernote.  (Technically wrt the search grammar),  It's ALL or ANY.  You would want this to be an ALL search, which you can toggle from ANY. IOW, the note must meet ALL criteria.  A note with only one tag of Q3 is not displayed in the results pane b/c it does not meet ALL criteria, since it does not meet the criteria of -tag:q3.  It's very easy to test yourself.  Start out with only -tag:q1.  See what notes are displayed.  Then add -tag:q2 & see what notes are removed from the results pane.  Then add -tag:q3 to the search, etc, etc, etc.

 

Wait, what? Technically, and logically speaking, an ALL search in Evernote, is exactly equivalent to a search where all of its terms are ANDed together, while an ANY search is exactly equivalent to a search where all if its terms are ORed together. Relevant quote from the Search Grammar doc:

"By default, the search results are the intersection of the notes that match each individual search term. This behavior changes if the "any:" modifier is found in the search. In this case, the search is executed as a union of the matches of the individual terms, and notes will be returned that match any of the criteria terms. The results are obviously identical if there is only one search term."

 

"Intersection" just means logical AND and "union" means logical OR. The search grammar doesn't explicitly express the ANDs or ORs, it just denotes that the search is one or the other by using the absence or presence of the "any:" modifier.

 

Must be too early on West Coast time for this stuff; better hit up the cappuchino machine for another dose!!

 

Yes but OP is thinking (emphasis mine):

 

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 as suggested by Jeff, returns all the notes because it is an 'AND' query and no records are tagged with all of them.

WRT the Evernote search grammar, it's "any" vs "all", at least in the Windows client where this is toggled. Perhaps I should have worded it differently. But for this example, I think it's clearer to think in terms of ALL rather than AND. 

 

Especially since there were a few folks thinking OP's query was not possible...

Link to comment

Happyatom says he/she would like to find any Note that does not have at least one of these tags.

 

A Note which has Q1, Q2, & Q3, but not Q4 would meet that criteria.

 

Happyatom, please clarify.

 

Since the note does have at least one of those tags (it actually has three), it would NOT meet OP's criteria.

Link to comment
  • Level 5*

WRT the Evernote search grammar, it's "any" vs "all", at least in the Windows client where this is toggled. Perhaps I should have worded it differently. But for this example, I think it's clearer to think in terms of ALL rather than AND. 

 

Especially since there were a few folks thinking OP's query was not possible...

The funny thing is that the search grammar uses both classical logic terms ("intersection" and "union", quoted above) and "any" and "all" (when describing the "any:" modifier), but it never explicitly labels a default search as a ALL search, nor a search with "any:" as an ANY search. Regardless, because AND/OR and ALL/ANY are exactly equivalent in Evernote's world; it's fine to use whichever is more comfortable or gets you to the result that you want. I translate to AND/OR because that's more familiar to me.

The translation of my search given the the Search Explanation panel is pretty amusing, though:

Viewing 22 notes from [Test} matching [All] none of the following: tagged with [Q1][Q2][Q3][Q4]

Link to comment
  • Level 5

So that I'm clear.

I'm correct in suggesting the OP is confused that Jeff's search does not work?:

-tag:Q1 -tag:q2 -tag:q3 -tag:q4 where the OP infers that it returns all records because "it is an 'AND' query and no records are tagged with all of them."

 

I don't see that in evidence in Jeff's recreation, or in my own.

Adding any single Q[1-4] tag to the note, regardless what ever additional tags it may or may not have, drops it out of the search results.

 

It performs the same function as -tag:Q*  (apart from any tag naming collisions)

 

Agreed that there are potential collisions with similar named tags, so other forms with symbols/spaces would be advantageous.

 

But when Evernote search says ALL in the search description, that means must have ALL of the positive search criteria, as well as none of the individual negative search terms.

The negative search terms however are ANY, not ALL.

 

Because of this isn't it true to say that you cannot find with a single search, a note which does not have all 4 of a set of 4 tags.  But you can find with a single search, notes which do have all 4 of a set of 4 tags (and no less).

tag:Q1 tag:Q2 tag:Q3 tag:Q4 means all must be present

-tag:Q1 -tag:Q2 -tag:Q3 -tag:Q4 means must not have any of those individual tags

 

I recognize that the OP was NOT asking to find notes that have 3 or less of the Q[1-4] tags.  

 

Thinking out loud, wouldn't that require 4 searches like:

tag:Q* -tag:Q4

tag:Q* -tag:Q3

tag:Q* -tag:Q2

tag:Q* -tag:Q1

Link to comment
  • 1 year later...

After reading some of these posts I attempted to do a saved search. Intent is to find notes added to my to do list notebook (actions pending) which were not properly categorized with a "when context" via a child tag under the parent tag of ".when"

 

 

For those familiar with TSW, I created .when tags to organize my priorities. I have some notes without any of my numbered child .when tags which I want to find via a saved search. Below is the search I used and I must have done something wrong. Anyone know what I did wrong so I can fix? Will post pic as soon as I figure out how to screenshot on a MAC....being new to it doesn't help with being new to EN too.

 

notebook:"Actions Pending" -tag:0-daily -tag:1-now -tag:2-next -tag:"3-this week" tag:"4-this month" -tag:5-later -tag:6-someday -tag:7-waiting

Link to comment
  • Level 5*

Look and see if you have the matching operator set to all on (should be able to see it if you have View - Show Search Explanation checked).  If you change the matching operator to ANY I think your search will return notes without one of your when tags.

 

Sidebar, I implemented TSW as well.  I decided to precede my when tags with an !, !1-Now, !2-Next, etc. The benefit in a case like yours is that a -taq:!* search will yield the same result.  Two other benefits, when applying tags hitting ! gives you a drop down of only when tags and if you sort by tags the ! tags end up sorting to the top of the list.  FWIW.

Link to comment

So I think I copied the link wrong from dropbox search field to this forum because when I went back to add the "any" command it was already there.

 

Now it won't let me copy from the search field to this forum but below is what I see: (note when I try to "edit" the saved search by clicking edit and removing one of the any:'s it just pops back up the next time I run the search even after resaving the search. Help is appreciated! What I see in evernote is typed below by hand:

 

notebook:"Actions Pending" any:any: -tag:0-daily -tag:1-now -tag:2-next -tag:"3-this week" tag:"4-this month" -tag:5-later -tag:6-someday -tag:7-waiting

 

 

 

BTW cshilling I will also try the exclamation mark thing. Good idea!

 

Look and see if you have the matching operator set to all on (should be able to see it if you have View - Show Search Explanation checked).  If you change the matching operator to ANY I think your search will return notes without one of your when tags.

 

Sidebar, I implemented TSW as well.  I decided to precede my when tags with an !, !1-Now, !2-Next, etc. The benefit in a case like yours is that a -taq:!* search will yield the same result.  Two other benefits, when applying tags hitting ! gives you a drop down of only when tags and if you sort by tags the ! tags end up sorting to the top of the list.  FWIW.

Link to comment
  • Level 5*

@Deal

What is wrong with the results when you do the search?

IMO, a search in the notebook of -tag:0-daily -tag:1-now ... etc, should yield all notes in the notebook without a WHEN tag. Also, I may have misspoke initially; a group of -tag search parameters are cumulative removals from the set so the any doesn't apply. I think in any case, one can get a headache with this stuff. That's why the leading ! Is so appealing to me. ;-)

Link to comment
  • 2 years later...
On 4/29/2015 at 4:09 AM, csihilling said:

@Deal

What is wrong with the results when you do the search?

@csihilling

 

Must not have set my notifications right because I just saw this.  I don't understand your explanation above and I did try changing it to the exclamation marks before the .when tags. I now understand the concept that if I have all of my .when tags with ! before the number, I can somehow more easily set a search filter for anything in my actions pending notebook that doesn't have a !Tag but not quite sure how to do it. Tried messing around with my old formula and came up with the search below but it didn't work at all. 

 

notebook:"Actions Pending" any: tag:!

Link to comment
  • Level 5*
34 minutes ago, DealHaggler18 said:

notebook:"Actions Pending" any: tag:!

Try adding a wildcard search as in     notebook:"Actions Pending" any: tag:!*

Documentation for Evernote Search is at    Evernote Search Grammar

The tag name may end with a wildcard to match the beginning of a tag

Link to comment
  • Level 5*
43 minutes ago, DealHaggler18 said:

I can somehow more easily set a search filter for anything in my actions pending notebook that doesn't have a !Tag but not quite sure how to do it

notebook:"Actions Pending" -tag:!* should return all notes in the notebook that don't have an !actiontag.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...