Grammar for Search Query
I am planning to write some code for a Zimlet which will search specific fields in an Appointment. For this I need to understand the Grammar of the element <query></query> in the Search request.
I have downloaded the source of Zimbra 4.5.6, but I could not find the Grammar file which is used by the Zimbra Server to parse the search queries. As far as I understand Zimbra uses Java CC parser to read the Grammar files and generate the Code.
Please let me know if my understanding is incorrect.
I would like to know if these Grammar files are also shipped with the Zimbra 4.5.6 Open Source edition? If it is shipped please let me know where could I find the Grammar file for the Search queries?
Any help in this regard will be greatly appreciated.
Not really sure what you mean by grammar, but the SOAP API is spelled out here:
Among other useful information..
Grammar for Search Query
Thanks for your inputs.
By Grammar I mean the the Language and Grammar which is generally used to generate parsers. When a users fires a search request to the Zimbra Server it contains an element <query> which contains the query user has fired. This query is parsed on the Zimbra Server side by a parser which is generated by Java CC (A Parser generation tool in java) found at https://javacc.dev.java.net/
This tool needs a Language and Grammar to generate a parser as it is with other classical tools like Yacc (mostly used with lex-another tool).
To be specific I would like to know the Grammar for query element in following code
Above mentioned search criteria is just an example and there are other various complex scenario's possible for the search criteria in <query></query> node.
offset="0" limit="25" types="message,contact,appointment,wiki,document"><tz id="(GMT+05.30) Chennai
/ Kolkata / Mumbai / New Delhi"/><locale>en-US</locale>
<query>((from:(swapnil)) OR (from:(ajay))) in:inbox larger:2kb</query>
By the way, i found explanation of the individual items in search query at the following Zimbra Wiki page. It explains the Grammar but it in itself does not have the Grammar file used to generate the parser.
Search Tips - Zimbra :: Wiki
Does Zimra ship the Grammar and Language files in Open Source edition?
If yes where could I find it? I am using 4.5.6 Open source edition.
Take a look at ZimbraServer/docs/query.txt
Thanks cdamon for the reply.
Actually I have read the mentioned document and also the link mentioned at Search Tips - Zimbra :: Wiki
I am looking for the exact grammar file used as input to the Java CC tool, to generate the parser.
Actually I am developing a zimlet to which the complex search query will be passed and I need to parse this search query. So if i have the exact grammar files it would help me to code better the parser which will parse the search query, as i will consider all the use-case scenarios in a better way.