Search for Tags in Notes starting with "...-" using Search (not Notes) Tool

Hi everyone,
I have an hierarchical system for creating Tags with “-” being used to build the hierarchy. For example, one of the Tags is “Trust God-” I want to bring up all notes with Tags starting with “Trust God-” using the Search function in order to edit some of the Tags. [Note: There is a “-” at the end but not the beginning.]
I am not interested in using the Notes => Filters to do the above for 2 reasons:
1) With Notes, it shows only a few entries matching the Filter at a given time and have to hit “More” to see the full list (even then, only 100 is the max)
2) Once you pick one selection and then go into the Note to edit the Tag, you can’t get back to the starting point to edit other selections without multiple clicks. But with Search, the search results never go away. You keep clicking each of the search results one after another to go through the whole list. So many clicks avoided when using Search. Also with Search, it also groups the Search results by Notebook, which is also super helpful.
Any help would be super appreciated. Thank you.
I believe in a Win-Win-Win God.
Comments
-
@1Cor10 31 I am not sure what your question actually is. Can you elaborate please?
0 -
Sorry for making the question more confusing than it needs to be. So let me start again.
I have many Tags starting with, say, Trust God. For example, possible Tags are Trust God-Defn-X, Trust God-Why-Y, Trust God-Consequence-Z etc. I would like to use Search function to get all the Notes containing these Tags.
If I were to write a computer program, I would ask it to grab all Tags where the first 10 characters are “Trust God-”. How would I accomplish this using Search function?
Please let me know if I am still being vague.
Thanks
I believe in a Win-Win-Win God.
0 -
Normally, a mytag: search in Docs using quotation marks will do just that. For instance, in the example below, the search "mytag:"Jesus, Deity" will find notes tagged with "Jesus, Deity of."
0 -
Thanks a ton, Francis. The quotation marks makes all the difference! I have some closure on this issue.
But I started digging around. So I started comparing the Search results with and without the quotation mark. I’m trying to understand how Search works by doing this comparison. I found it identified Notes where the word “God” is not even in the Tag. Only the word “Trusting” was is in the Tag. I wondered how it could have picked this Note. As it turns out, “Trust” and “God” are in the Note but not in the Tag. This seems odd, isn’t it? Doesn’t “mytag” Search search only the Tags?
I believe in a Win-Win-Win God.
0 -
Although this concerns searching library filters, one would infer that it should be so for doc searches as well:
You might want to report as bug.
0 -
Thank you. Is there a formal way to report a bug? I've never reported one thus far. Happy to do that.
I believe in a Win-Win-Win God.
0 -
I’m trying to understand how Search works by doing this comparison. I found it identified Notes where the word “God” is not even in the Tag. Only the word “Trusting” was is in the Tag. I wondered how it could have picked this Note. As it turns out, “Trust” and “God” are in the Note but not in the Tag. This seems odd, isn’t it? Doesn’t “mytag” Search search only the Tags?
When you put
mytag:
in your query, it's going to search for the very next word or phrase in the tags. Anything after that is treated as a separate term in the query, which by default is just searching the content. And by "very next", I mean exactly that. If you have a space right aftermytag:
it will interpret that as an empty tag.This means that
mytag:Trust God
is searching forTrust
in the tags andGod
in the content.If you don't have a closing
"
then it's invalid syntax, and the behavior is not well defined. It might treat it like the opening quote doesn't exist, or it might treat it likemytag:
doesn't exist, or it might do something else entirely.
So, as far as I can see, there's no bug here. It's working as expected.Andrew Batishko | Logos software developer
0 -
Thank you so much, Andrew, for stepping in to answer my question. Much much appreciated. I am wondering if I can press you for some clarifications:
You say: “When you put mytag: in your query, it's going to search for the very next word or phrase in the tags.” Can you please give an example of a phrase without a space in between two words? The reason I’m asking is that you said the moment Search sees an empty space, anything that follows the empty space will be searched in the content. So I want to know how to search for a phrase in the Tag but without putting a space in between. Do I put a phrase within quotes?
You say: “If you have a space right after mytag: it will interpret that as an empty tag.”
I actually tried that because I’d like to catch Notes that I’ve made that I have not Tagged. But the Search did not even run. I got the message: “Found extra space after colon: myTag:
You say: “This means that mytag:Trust God is searching for Trust in the tags and God in the content." When you say “content”, is it the body of the Note? The Anchors in the Note? Or Both?
A final question: Is it possible to Search separately for Tags starting with “Trust God” versus Tags that have “Trust God” somewhere in between; for example a Tag such as “God-Good-Consequence-Trust God”?
Thank you Andrew.
I believe in a Win-Win-Win God.
0 -
You say: “When you put mytag: in your query, it's going to search for the very next word or phrase in the tags.” Can you please give an example of a phrase without a space in between two words? The reason I’m asking is that you said the moment Search sees an empty space, anything that follows the empty space will be searched in the content. So I want to know how to search for a phrase in the Tag but without putting a space in between. Do I put a phrase within quotes?
The only way to represent a phrase is with quotes.
mytag:tag content
searches for "tag" in the tags and "content" in the content.mytag:"tag phrase"
searches for "tag phrase" in the tags.You say: “If you have a space right after mytag: it will interpret that as an empty tag.”
I actually tried that because I’d like to catch Notes that I’ve made that I have not Tagged. But the Search did not even run. I got the message: “Found extra space after colon: myTag:
Right. My apologies. I neglected to mention that an empty tag is invalid syntax. It used to be a common error that people would put a space after the field, like
mytag: tag
and not know why they were getting unexpected results. I didn't realize we had added a specific error message for that.I actually tried that because I’d like to catch Notes that I’ve made that I have not Tagged.
This should work:
* NOT mytag:*
although the counts will look high because its counting all words.You say: “This means that mytag:Trust God is searching for Trust in the tags and God in the content." When you say “content”, is it the body of the Note? The Anchors in the Note? Or Both?
Sorry. Let me be more clear. "Trust" and "God" are separate terms (because they don't have quotes around them that make them a single phrase term. Each term can be prefixed with text that indicates which field that term should search.
mytag:
indicates that the term is searched for in the tags. If no field prefix is specified, then it searches everything. So formytag:Trust God
it is looking for "Trust" in the tags and "God" anywhere.Is it possible to Search separately for Tags starting with “Trust God” versus Tags that have “Trust God” somewhere in between; for example a Tag such as “God-Good-Consequence-Trust God”?
That depends on whether you have a maximum of one tag on your notes or if you sometimes use more than one.
mytag:"Trust God" AFTER mytag:*
searches for a tag that contains the phrase "Trust God" and makes sure it comes after any other text in a tag. The reason it only works if you use a single tag per note is that when notes are indexed, all of the information about the note is indexed like it's a single document. The anchors show up first, then the content, then the tags. You can use positional search syntax and it will treat those different parts as if it were text in that order. So, if you have multiple tags, then themytag:*
term might come from a different tag and not the same one that has "Trust God".Hmm… that reminds me of another way you can see problems with tag searching… Because the tags are all treated as belonging to one document, if you had these two tags on your note:
Trust
andGod
and then you searched formytag:"Trust God"
you might get a match on that note even though it doesn't have a single tag with that text. I say "might" because it would depend on the order in which you added the tags to the note.Tags were really designed for using distinct tags where you would do exact matching on the entire tag. They weren't designed to have some kind of hidden hierarchy. It's possible to do, but you need to be careful about choosing your terms in ways that won't overlap.
Andrew Batishko | Logos software developer
0