Difference between revisions of "Zimbra Web Client Search Tips"

m (subject: updated to remove Use quotes to search for an eact match, as this statement is incorrect.)
m (typo fix)
Line 75: Line 75:
 
'''in:''' Specifies a folder. For example, <span class="code">in:sent</span> would show all items in your ''''''Sent'''''' folder.
 
'''in:''' Specifies a folder. For example, <span class="code">in:sent</span> would show all items in your ''''''Sent'''''' folder.
  
'''under:''' Specifies searching a folder and it's sub-folders.
+
'''under:''' Specifies searching a folder and its sub-folders.
  
 
'''has:''' Specifies an attribute that the message must have. The types of object you can specify are "attachment", "phone", or "url". For example, <span class="code">has:attachment</span> would find all messages which contain one or more attachments of any type.
 
'''has:''' Specifies an attribute that the message must have. The types of object you can specify are "attachment", "phone", or "url". For example, <span class="code">has:attachment</span> would find all messages which contain one or more attachments of any type.

Revision as of 18:26, 13 October 2010

Search language description

Some type of query is always applied to produce the view that you see in the Zimbra interface. This topic describes in detail the search grammar used for Zimbra's Search feature & the most overlooked feature: The main search bar!

  • TIP: You can set your General Options to 'Always show search string' to see the current query in the Search toolbar. For example, when this option is set, clicking your Inbox folder shows the query string 'in:inbox'.
  • If you set the "Initial mail search:" to something besides in:inbox and upon login you will be taken to that folder/results first.

Search Language Structure

Simple searches can be done by just entering a word into the search field. Bare words (words without a search operator) are interpreted to search in the 'content:' operator -- this matches any text in the message.

More advanced searches can be done by specifying a search operator. A search operator is a special keyword followed by a colon, followed by some other parameter specific to that operator. For example:

  • in:inbox the operator is "in" and the parameter is "inbox" - this returns messages which are in the folder named "inbox"
  • from:someone the operator is "from" and the parameter is "someone" - this returns messages which have the word "someone" in their email address

You can prefix any keyword with the word "not" to specify items that do not have that criterion, for example not in:inbox. Search is case insensitive, meaning that "in:inbox" is the same as "in:Inbox". The minus sign (-) is a synonym for NOT So: not in:inbox is the same as -in:inbox

In most cases, it is not necessary to include punctuation-type characters in your search string, as these are ignored by the search code. There are certain times where this is not true (for example, searching for a time '9:30' in a message) and in those cases you should enclose the search parameter in quotation marks. For example: subject:"9:30" will return messages which have the string 9:30 in the subject.

Allowable characters in the search parameter:

  • The following characters cannot be anywhere in a search parameter unless it is enclosed by quotes: ~ ' ! # $ % ^ & * ( ) _ ? / { }[ ] ; :
  • The following characters are allowed in a search parameter as long as they are not the first character: - + < >

Multiple Search Terms

If multiple search terms are entered (separated by spaces) they are ANDed together by default. in:inbox foo means "return me messages which are in the inbox AND which have the word foo in them". For searches using multiple criteria, you can either find items that match one of the specified criteria or all of them. You can perform both types of searches using the Advanced search builder in the UI.

For all search panes other than the Basic search, the rules are:

  • Searching for messages that match any of the specified criteria is called an 'OR' search, because if the message contains either X or Y, then it is considered a match. For Advanced search panes with multiple check boxes, making multiple selections within a single pane creates an 'OR 'search for those items.
  • Searching for messages that contain both X and Y is called an 'AND' search, because the message must meet all the specified criteria in order to be considered a match. For Advanced server panes with check boxes, opening multiple instances of the same pane and making different check box selections in each one causes the criteria to be specified as an 'AND' search.

Only "OR" appears in a query. If you selected as an option to show the search query in the Search bar as you make selections in the Advanced search, the Search text box updates to show the resulting query. With the 'AND' type of search, the word 'AND' does not appear.

Tip: Using parenthesis with AND and OR. Words within parentheses are considered as a unit. For example from: (john thomas) is equivalent to from:john AND from:thomas. If you use OR in the parenthesis, from:(john or smith), the search is for results from:john OR from:thomas.

Using * as a wildcard in Search

The asterisk (*) can be used as a wildcard in a search to find content that contains words that have similar spellings.

Use the asterisk * as a wildcard after a prefix. For example, the search string do* returns items such as do, dog, door, etc.


Escape character is Slash: \

There may be times that you will want to specify an exact match on a string that contains characters that normally are considered wildcards. For example, you might want to specify a match on a subject line where the main heading is surrounded on both sides by three asterisks, such as

      • Something***

To specify a wildcard as itself rather than a substitution for other characters, use the backslash \ immediately before the character. For example the comparison string "\*\*\**\*\*\*" specifies a subject with three asterisks before and after any string in the middle (including spaces).

Using ? as a wildcard in Search

The question mark is a placeholder for "exactly one character".

Example subject-line search string: banana?boat

With Matches: Subject lines such as "bananasboat", "banana-boat", "banana!boat", or "banana boat"


Keyword Descriptions and Examples

content: Specifies text that the message must contain. For example, content:bananas finds all items containing the word "bananas".

from: Specifies a sender name or email address that is in the From header. This can be text, as in "John Smith III", an email address such as "joe@acme.com", or a domain such as "@zimbra.com".

to: Same as from: except that it specifies one of the people to whom the email was addressed in the To: header.

cc: Same as from: except that it specifies a recipient in the Cc: header of the message.

subject: Specifies text that must appear in the subject header of the message. An example might be subject:new vacation policy.

in: Specifies a folder. For example, in:sent would show all items in your 'Sent' folder.

under: Specifies searching a folder and its sub-folders.

has: Specifies an attribute that the message must have. The types of object you can specify are "attachment", "phone", or "url". For example, has:attachment would find all messages which contain one or more attachments of any type.

filename: Specifies an attachment file name. For example, filename:query.txt would find messages with a file attachment named "query.txt".

type: Specifies a search within attachments of a specified type. The types of attachment you can specify are "text", "word", "excel", and "pdf". For example, type:word "hello" finds messages with attachments that are Microsoft Word documents and searches within those attachments for the word "hello".

attachment: Specifies any item with a certain type of attachment. For example, attachment:word would find all messages with Word attachments.

is: Searches for messages with a certain status - for example, is: unread will find all unread messages. Allowable values are "unread", "read", "flagged", "unflagged", "sent", "draft", "received", "replied", "unreplied", "forwarded", unforwarded", "anywhere", "remote" (in a shared folder), "local", "sent", "invite", "solo" (no other messages in conversation), "tome", "fromme", "ccme", "tofromme". "fromccme", "tofromccme" (to, from cc me, including my aliases)

date: Use this keyword to specify a date, using the format that is default for your browser's locale (for US English the format is mm/dd/yyyy). For example, date:2/1/2007 would find messages dated February 1, 2007. The greater than (>) or less than (<) symbols can be used instead of after or before. >= and <= are also allowed.

after: Specifies mail sent after a certain date. For example, after:2/1/2007 specifies mail sent after February 1, 2007.

before: Same as after: except specifies mail sent before the specified date.

size: Specifies messages whose total size, including attachments, is a specified number of bytes, kilobytes, or megabytes For example, size:12 kb would find messages that are exactly 12K in size. The greater than (>) or less than (<) symbols can be used instead of bigger or smaller.

larger: Similar to size: except specifies greater than the specified size.

smaller: Similar to size: except specifies smaller than the specified size.

tag: Finds messages which have been tagged with a specified tag. For example, tag:amber will find message that have a tag called "amber" applied.

Raw List of Search Parameters

content:{TEXT}

to:{TEXT|EMAIL_ADDR|DOMAIN}

from:[>,<,>=,<=]{TEXT} OR {EMAIL_ADDR} OR {DOMAIN}

cc:{TEXT|EMAIL|DOMAIN}

tofrom,tocc,fromcc,tofromcc -> equivalent to combinations like (to:X or from:X), etc

envto:{TEXT|EMAIL_ADDR|DOMAIN} // x-envelope-to mime header

envfrom:{TEXT|EMAIL|DOMAIN} // x-envelope-from mime-header

subject:[>,<,>=,<=]{TEXT}

in:{FOLDER_LABEL}

under:{FOLDER_LABEL}

has:{"attachment"|OBJECT_TYPE}

filename:{FILENAME}

type:{RAW_MIME_TYPE|FRIENDLY_MIME_TYPE}

attachment:{RAW_MIME_TYPE|FRIENDLY_MIME_TYPE}


item:{"all"|"none" -- all items, or no-item

| [0-9]+ --> item ID

|"{[0-9]+(,\s?[0-9]+)*}" -- ie {1,2,3} or {1} --> set of item_id's


is:{"anywhere"|"unread"|"read"|"flagged"|"unflagge d"|"sent"|"received"|"replied"| "unreplied"|"forwarded"|"unforwarded"|"invite" |

"solo"| // no other messages in conversation

"tome"|"fromme"|"ccme"|"tofromme"|"fromccme"|"tofr omccme" // to, from cc me, including my aliases

"local" - matches all folders in the local mailbox (that the user has READ access to)

"remote" - matches all remotely mounted folders (that the user has READ access to) }


date:[>,<,>=,<={DATE}

appt-start:[>,<,>=,<={DATE}

appt-end:[>,<,>=,<={DATE}

after:{DATE}

before:{DATE}

size:{SIZE}

larger:{SIZE}

smaller:{SIZE}

tag:{TAG}

modseq:[>,<,>=,<={CHANGE_ID}

my:{MY_SAVED_SEARCH_NAME} (UNIMPLEMENTED)

message:{DB_MSG_ID}

conv:{DB_CONV_ID}

  • conv-count:{NUM}
  • conv-minm:{NUM}
  • conv-maxm:{NUM}
  • conv-start:{DATE}
  • conv-end:{DATE}

author:{TEXT}

title:{TEXT}

keywords: {TEXT}

company: {TEXT}

metadata: {TEXT}

contact: {TEXT} // special-case searching for contact picker (matches type=contact documents only)

msgid: {TEXT} // Message-Id: field from mime header

sortscore|dateasc|datedesc|subjasc|subjdesc|name asc|namedesc) -- overrides the sort field specified in the <SearchRequest>

FRIENDLY_MIME_TYPE:"text"|"application"|"word"|"ms word"|"excel"|"xls"|"ppt"|"pdf"|"ms-tnef"|"image"|"jpeg"|"gif"|"bmp"|"none"|"any"

TEXT: text string, must be in "'s if has spaces in it

EMAIL_ADDR: text string, no spaces, with @ sign

DOMAIN: such as *.com

FOLDER_LABEL: mail|trash|spam|anywhere

TAG: tag_name OBJECT_TYPE: "phone" "url" "credit-card" etc...types of parsed objects

DATE: absolute-date = mm/dd/yyyy | yyyy/dd/mm OR

relative-date = [+/-]nnnn{minute,hour,day,week,month,year}

(eg "this week" is date:-0week, "last week" is date:-1week, "this month" is date:-1month, etc.)

SIZE: ([<>])?n+{b,kb,mb} // default is b

DB_MSG_ID: ??

NUM: ([<>])?n+

search by folder ID inid:folderID

Query.txt dump

   content:{TEXT}

   to:{TEXT|EMAIL_ADDR|DOMAIN}

   from:[>,<,>=,<=]{TEXT} OR {EMAIL_ADDR} OR {DOMAIN} 

   cc:{TEXT|EMAIL|DOMAIN}

   tofrom,tocc,fromcc,tofromcc -> equivalent to combinations like (to:X or from:X), etc

   envto:{TEXT|EMAIL_ADDR|DOMAIN} // x-envelope-to mime header

   envfrom:{TEXT|EMAIL|DOMAIN}    // x-envelope-from mime-header 

   subject:[>,<,>=,<=]{TEXT}

   in:{FOLDER_LABEL}   // search in a specific folder

   under:{FOLDER_LABEL} // in specified folder AND ALL SUBFOLERS

   has:{"attachment"|OBJECT_TYPE}

   filename:{FILENAME}

   type:{RAW_MIME_TYPE|FRIENDLY_MIME_TYPE}

   attachment:{RAW_MIME_TYPE|FRIENDLY_MIME_TYPE}

   item:{"all"|"none" -- all items, or no-item

         | [0-9]+  --> item ID

         |"{[0-9]+(,\s?[0-9]+)*}" -- ie {1,2,3} or {1} --> set of item_id's

   is:{"anywhere"|"unread"|"read"|"flagged"|"unflagged"|"sent"|"received"|"replied"|

       "unreplied"|"forwarded"|"unforwarded"|"invite"|

       "solo"|  // no other messages in conversation

       "tome"|"fromme"|"ccme"|"tofromme"|"fromccme"|"tofromccme"  // to, from cc me, including my aliases

       "local" - matches all folders in the local mailbox (that the user has READ access to)

       "remote" - matches all remotely mounted folders (that the user has READ access to)

       } 

   date:[>,<,>=,<={DATE}

   appt-start:[>,<,>=,<={DATE} 

   appt-end:[>,<,>=,<={DATE} 

   after:{DATE}

   before:{DATE}

   size:{SIZE}

   larger:{SIZE}

   smaller:{SIZE}

   tag:{TAG}

   modseq:[>,<,>=,<={CHANGE_ID}

   my:{MY_SAVED_SEARCH_NAME}   (UNIMPLEMENTED)

   message:{DB_MSG_ID}

   conv:{DB_CONV_ID}

*   conv-count:{NUM}

*   conv-minm:{NUM}

*   conv-maxm:{NUM}

*   conv-start:{DATE}

*   conv-end:{DATE}

   author:{TEXT}

   title:{TEXT}

   keywords:{TEXT}

   company:{TEXT}

   metadata:{TEXT}

   contact:{TEXT}  // special-case searching for contact picker (matches type=contact documents only)

   msgid:{TEXT}   // Message-Id: field from mime header



   // Structured-Data search operator (see below):

   field[FIELDNAME]:{TEXT} or #FIELDNAME:{TEXT}

   

   sort:(score|dateasc|datedesc|subjasc|subjdesc|nameasc|namedesc)

      -- overrides the sort field specified in the <SearchRequest> 



* : not currently supported



FRIENDLY_MIME_TYPE:"text"|"application"|"word"|"msword"|"excel"|"xls"|"ppt"|"pdf"|"ms-tnef"|"image"|"jpeg"|"gif"|"bmp"|"none"|"any"

TEXT: text string, must be in "'s if has spaces in it

EMAIL_ADDR: text string, no spaces, with @ sign

DOMAIN: such as *.com

FOLDER_LABEL: mail|trash|spam|anywhere

TAG: tag_name

OBJECT_TYPE: "phone" "url" "credit-card" etc...types of parsed objects

DATE:  absolute-date = mm/dd/yyyy | yyyy/dd/mm  OR

       relative-date = [+/-]nnnn{minute,hour,day,week,month,year}

       (need to figure out how to represent "this week", "last

       week", "this month", etc)

SIZE: ([<>])?n+{b,kb,mb}    // default is b

DB_MSG_ID: ??

NUM: ([<>])?n+


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

 
Fields

--------

content-related



  content:  # this should be the default field
    

header-related


  from:

  to:

  cc:{name|domain}

  subject:


  

saved-search-related:     (UNIMPLEMENTED)



  my:{name-of-saved-search}

  

  i.e., could have a saved search of "domain:example.zimbra.com"

  called "zimbra" and say:

  

  my:zimbra

  

object-related fields:



  has:attachment              constrains search to messages with attachments

  has:{phone|url|ssn|po...}           messages with "objects" 


    

mime-related



  filename:{file-name}        constrains search to messages with attachments of given name

  type:{mime-type}            constrains search to blobs of the given type

  attachment:{mime-type}      constrains search to messages with attachments of the given type



  mime-type = raw-mime-type | mime-type-alias

  raw-mime-type = type/sub-type (i.e., text/plain)

  # aliases are "user-friendly" mime types

  mime-type-alias = "word" | "excel" | "pdf", "image", "audio", etc...



  EXAMPLES:  

         type:word "hello"             searches within only words docs for "hello"

         attachment:word "hello"       searches within messages that have word docs for "hello"

         attachment:image/*            matches all messages that have image attachments


       

flags



  is:anywhere --> in any folder (overrides spam-trash setting for that query part)

                     note that "is:anywhere" does NOT imply "across all mountpoints".  Mountpoints must

                     be explicitly included with an "in:" term -- in:mountpointname.

  is:unread

  is:read

  is:flagged

  is:unflagged

  is:sent

  is:received

  is:invite

  is:solo --> true if the item has no conversation 



  The flag name can also be used in a search:

    tag:\{FlagName} where {FlagName} is one of the following values:

      Attached, Answered, Copied, Deleted, Draft, Flagged, Forwarded, Notified, Subscribed, Unread

  

date-related fields



  after:{date}

  before:{date}

  date = {absolute-date} | {relative-date}



  absolute-date = mm/dd/yyyy | yyyy/dd/mm

  

  relative-date = [+/-]nnnn{minute,hour,day,week,month,year} 



  NOTE: need to figure out how to represent "this week", "last week", "this month", etc. probably

        some special casing of relative dates and use with after/before. i.e., maybe "after:-2d AND before:0d" means

        yesterday? i.e., for relative day/week/month/year, you zero out month/week/day/hour/minute?



  last 4 hours:   after:-4hour 

  today:          after:0day

  yesterday:      (after:-2day AND before:0day)

  this week:      after:0week

  last week:      (after:-2week AND before:0week)

  this month:     after:0month

  last month:     (after:-2month AND before:0month)

  this year:      after:0year

  last year:      (after:-2year AND before:0year)

  last year and older:  before:0year



appointment search operators

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

  appt-start:  appt-end:

     Search based on the start and end times of the appointment.

     For non-recurring appointments, this is basically what you

     expect.  For recurring appointments, the start and end times are

     the *earliest possible* time (start of the first instance in the

     recurrence) and *latest possible* time, or sometime in 2099 if

     the recurrence has no end.

     
  


size-releted fields



  larger:{size}

  smaller:{size}

  size:{size}

  

  size is [<>]nnnn{b,kb,mb,gb}    # default is kb?


  

tag-related fields



   tag:{user-defined-tag}



      

domain-related fields



  domain:{domain-list}

  EXAMPLES: domain:stanford.edu OR: domain:*.org


    

db-related fields



  message:{db-message-id}        # constrain searches to a particular message


 

conversation-related-fields:  

  conv:{db-conv-id}      # constrain searches to a paritcular conversation

*  conv-min-count:{num}   # constrain searches to conversations of a particular length

*  conv-max-count:{num}   # constrain searches to conversations of a particular length

  conv-start:{date}

  conv-end:{date}



metadata-related fields



  author:

  title:

  keywords:

  company:

  metadata:

  

  The metadata fields refer to the metadata of a non-textual attachment.

  The fields author, title, keywords, company refer to the metadata fields 

  of the same name in the document.

  The field metadata aggregates all the metadata fields including the above four.

  E.g.,

	author:acme     finds all attachments whose author is acme

	metadata:acme   finds all attachments where acme appears in any metadata

	                fields, including author.



misc fields



*  minm:nnnn                     # constrain to conversations with at least nnnn messages

*  maxm:nnnn                     # constrain to conversations with at most nnnn messages



  

other-mime-specific fields



  how do we want to handle doc properties from word, pdf, mp3, etc?



  i.e.:

         genre:rock OR artist:rush

         title:"customer visit"

         keywords:security

         author:ross



*   maybe {mime-type-alias}.field? i.e.:

  

          audio.genre:rock OR audio.artist:rush   (or mp3.*?)

          word.title:hello

          

   where the mime-type-alias can be left off if field is non-ambigious?

   

   do we want to try and promote certain fields that we can share between mulitple types? (title, author, keywords)


 

Structured-Data Searching

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

Search/Indexing now has the ability to analyze and store data in

Name-Value pairs in such a way that they can be searched for in a

structured way by the query language.



For example, Contact name-value pairs are indexed this way.



Structured data is stored in the "l.field" lucene field, and it should be added to the index document in a format like this: 

      "fieldOne:value1 value2 value3 value4\nFieldTwo:value2 value3 value4"

      

The search language has been extended to allow field searches to be expressed like this:

     #FieldName:value

     

For example, to find a contact with the last name "Davis" you would use a search query like:

     #lastname:davis

OR

     FIELD[lastname]:davis


Verified Against: Unknown Date Created: 4/30/2007
Article ID: https://wiki.zimbra.com/index.php?title=Zimbra_Web_Client_Search_Tips Date Modified: 2010-10-13



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search