Skip to content

Instantly share code, notes, and snippets.

@evernotegists
Created April 4, 2013 20:07
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save evernotegists/5313755 to your computer and use it in GitHub Desktop.
Save evernotegists/5313755 to your computer and use it in GitHub Desktop.
search = [ notebook , separator ] ,
[ "any:" , separator ] ,
term ,
{ separator , term } ;
notebook = "notebook:" , ( word | quoted ) ;
word = wordchar , { wordchar } ;
quoted = '"' , { ( any - '"' ) | '\"' } , '"' ;
separator = { sepchar , separator } ;
sepchar = any - ( wordchar | '"' | "-" ) ;
term = "-" negatable
| negatable
;
negatable = literal
| expression
;
literal = word | quoted | prefix ;
prefix = { wordchar } , "*" ;
expression = label , ":" , value ;
(*
* Expression labels must be:
* The name of a NoteAttribute field (e.g. "subjectDate")
* or a ResourceAttribute field (e.g. "fileName"),
* or one of: "tag", "intitle", "created", "updated", "resource",
* "todo", or "encryption".
* Search results are undefined if an unknown label is used.
*)
label = word ;
(*
* The expression value will be interpreted based on the type of the
* field or attribute.
* Search results are undefined if the value does not match the
* required format for this field.
*)
value = nonspace | quoted ;
nonspace = { any - space } ;
space = ? whitespace character (Unicode character class Z) ? ;
wordchar = ? any Unicode Letter or Number (Unicode character classes L and N) or underscore '_' ? ;
any = ? any printable characters ? ;
</pre>
<p>
The following additional production rules indicate the expected format of expression values to match various note fields and attribute types described above.
</p><pre class="longline">boolean = "true"
| "false"
| "*"
;
double = [ "-" ] , digit , { digit } , [ "." , { digit } ]
| "*"
;
datetime = absolutedate
| relativedate
| "*"
;
absolutedate = year , month , day ,
[ "T" , hour , minute , second ] , [ "Z" ];
year = digit , digit , digit , digit ;
month = ( "0" | "1" ) , digit ;
day = ( "0" | "1" | "2" | "3" ) , digit ;
hour = ( "0" | "1" | "2" ) , digit ;
minute = ( "0" | "1" | "2" | "3" | "4" | "5" ) , digit ;
second = ( "0" | "1" | "2" | "3" | "4" | "5" ) , digit ;
relativedate = relative
| relative , "-" , { digit }
;
relative = "day" | "week" | "month" | "year" ;
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
@joaosa
Copy link

joaosa commented May 23, 2018

Thank you for providing us with this!

It doesn't seem like it's entirely up to date though. I might be missing something, but according to this grammar, I'd be able to search with something like: "notebook:calendar intitle:month".

After verifying it didn't work as I expected, I checked the docs above this gist (https://dev.evernote.com/doc/articles/search_grammar.php) and I realized that the "intitle" option takes a "literal" value instead of a "negatable".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment