-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Prior to zettelgeist v.1.1.5, queries with zfind
worked as described in the baseball tutorial. The grammar of query strings has changed, such that
zfind --database index.db --query-string 'tags:"National League"' --count
is equivalent to
zfind --database index.db --query-string 'tags:"National" | tags:"League"' --count
Both queries return 29 zettels, whereas there are 15 zettels with the tag "National League". (In all examples here index.db
is populated by the zettels in zg-tutorial/zettels/baseball
.) zfind
seems to be handling the space character as the operator OR.
The expected outcome is achieved in this case by joining the search terms with an underscore:
zfind --database index.db --query-string 'tags:"National_League"' --count
Yet the behavior of zfind
is stranger than this initial example suggests, as shown by the results of the following queries:
zfind --database index.db --query-string 'tags:"AL Central"' --count
zfind --database index.db --query-string 'tags:"AL_Central"' --count
These two queries return 9 and 6 zettels, respectively.
The first query (for the string "AL Central") returns the five zettels with the tag "AL Central" plus four zettels in which the word-token "AL" does not appear in the tags. (The four false returns have the tags "NL Central" and "National League".) In this case --query-string 'tags:"AL Central"'
is not equivalent to --query-string 'tags:"AL" | tags:"Central"'
. Something else is going on. What?
The second query (for "AL_Central") returns the five correct zettels plus los-angeles-angels.yaml
. Again, I do not understand why.