JQL Functions - Search Attachement

Simple JQL aliases

Available from 1.6.1 version

Plugin provides simple aliases for havingAttachments JQL.

You can use:

AliasEquivalent havingAttachments JQLResult
issue in attContent("word")issue in havingAttachments("content: word")returns list of issues which have an attachment, which contains a 'word' inside file content
issue in attType("pdf")issue in havingAttachments("type:pdf") all issues with 'pdf' attachments
issue in attName("sample")issue in havingAttachments("sample")all issues that have attachment with name 'sample'

Advanced function - havingAttachments

The add-on provides havingAttachments("query") JQL function, where syntax of the query is a bit similar to Google or Bing search engine query syntax, for example:

  • issue in havingAttachments("word") - returns list of issues which have an attachment, which contains a word inside file content;
  • issue in havingAttachments("\"multi-word text\"") - all issues with attachments with a multi-word text in their file contents;
  • issue in havingAttachments("text1 OR text2") - all issues with attachments with either text1 or text2 somewhere in their file contents;
  • issue in havingAttachments("text1 text2") - same as issue in havingAttachments("text1 OR text2") - this is the main difference from Google query syntax - here space means not and but or;
  • issue in havingAttachments("text1 AND text2") - all issues with attachments with both text1 and text2 somewhere in their file contents;
  • issue in havingAttachments("content:text") - same as issue in havingAttachments("text");
  • issue in havingAttachments("type:pdf") - all issues with pdf attachments;
  • issue in havingAttachments("name:workflow OR type:png") - all issues that have attachment with name workflow or with png file extension;
  • issue in havingAttachments("name:summary AND type:txt") - all issues that have attachment with name summary and with txt file extension;
  • issue in havingAttachments("\"search attachment for JIRA add-on\" AND name:article01") - all issues that have an attachment containing search attachment for JIRA add-on text and the attachment file is named article01 (without the extension);
  • issue in havingAttachments("") or just issue in havingAttachments() - returns list of issues which have at least one attachment (with any contents).

In general, you can use any Lucene query, with the following fields available:

  • content, which searches inside attachment file contents. It's the default field if you don't specify any field explicitly.
  • name, which searches by names of the attachment files excluding file extensions;
  • type, which searches by file extensions (pdf, doc, txt, xls, odt, ods, xml, html, ...)

Wildcards

Two wildcards (* and ?) can be used in search terms. Wildcards will not work if you search for phrase like: havingAttachments("\"multi-word text\""). Wildcards are ignored when used in phrases.

  • " * " is used for multiple characters wildcard search: tes*, te*t. Term can't start with *, it can be used at the end or in the middle of search term.
  • "?" is used for single character wildcard search: tes?, te?t. Term can't start with ?, it can be used at the end or in the middle of search term.

Advanced syntax (Jira 8.x.x and higher)

Syntax used for writing queries is Lucene syntax. More details how to write advanced queries can be found in Lucene documentation.