Advanced Search And Introduction To JQL (JIRA Query Language)

Learn via video courses
Topics Covered

Overview

JIRA is a software development tool to plan, track and release projects in an agile manner. JIRA Query Language is the best way to search for issues in JIRA. It can be used to gain insights about the project and get the team's questions answered most flexibly.

Searching in Jira

There existthree typesof ways in which we can search things in JIRA.

They are:

  • Quick Search
  • Basic Search
  • Advanced Search

This type of search allows you to search across projects, issues, queues, boards, etc.

To perform a quick search, we can follow the given steps:

  1. Select the Search box in the top navigation bar or press the / key on the keyboard. Quick Search
  2. Choose from recent items or type to search.
  3. We can also filter the search results by choosing project or issue-related details.
  4. Select an item from the drop-down

In this type of search, we can search by using complex search queries with the help of a user-friendly interface without actually knowing the JIRA Query Language.

To perform a basic search, we can follow the given steps:

  1. Select Search and then click on View all issues.  Basic Search
  2. Set the criteria for a search like Project, Status, and Assignee details.
  3. We can also enter text to search for and add more criteria by clicking +More.
  4. Click Search.

In Advanced Search, we can search by JIRA Query Language(JQL) queries. Even a little knowledge of JQL can speed up many of our tasks and can benefit us to a great extent.

Basic knowledge of Structured Query Language (SQL) can be useful as JIRA Query Language shares many similarities with SQL.

To use JQL in the JIRA, one can follow the following steps:

  1. Click Issues and then Search for the issue
  2. Click on Edit if a search is in progress
  3. Click on Advanced Searching

Important Keywords to Know

There exist some keywords and operators that must be known well before we dive deeper into JIRA Query Language. Below is a list of some common keywords and operators.

Keywords

AND Returns if both the clauses around the keyword satisfy e.g. project = Individual AND status = "Completed"

OR Returns if one/both of the clauses around the keyword satisfies e.g. project = Individual OR status = "Completed"

IS Returns only if matches the condition specified e.g. description IS EMPTY

IN Returns only if matches the item list specified e.g. status IN ("In Progress", "Completed", "Open")

This can also be stated as: status = "Completed" OR status = "In Progress" OR status = "Open" which returns issues having status as "In Progress", "Completed", or "Open"

NOT IN Returns by excluding issues listed in the "IN" operator search. e.g. status NOT IN ("In Progress", "Completed")

Operators

!= Returns issues except having some particular condition e.g. status != "Completed"

>= Returns issues having greater than or equal condition e.g. "Story Points" >= 4

Similarly, we have the following:

  1. > greater than
  2. < smaller than
  3. <= smaller than or equal

JQL syntax

JIRA Query Language(JQL) comes into the picture while discussing Advanced Searching in JIRA. There exists JQL Queries similar to SQL queries. A query is a combination of one or more atomic conditions.

A simple JQL Query consists of 3 parts namely: JQL syntax

1. Fields: They refer to the different types of information such as issue type, issue priority, fix version, etc.

2. Operators: These are considered the heart of a query. They help in forming a relationship with the field. Some of them include =, !=, >, etc.

3. Values: These are the entities that contain the actual data and are usually the item that a developer look for while triggering a query.

Understanding Advanced Searching

Constructing JQL queries

A simple query in JQL looks like: project = "DEMO" This particular query will return issues in the "DEMO" project.

Similarly, a complex query will look like: project = "DEMO" AND assignee = Aayush

Setting the precedence of operators

The use of parentheses is recommended in complex JQL queries to enforce the precedence among the operators used.

For example, if we want to find open issues in the 'Scaler_Topics' project, and issues currently assigned to the system administrator "Aayush", we can use parentheses to enforce the precedence.

(status=open AND project=Scaler_Topics) OR assignee=Aayush

By default, if not specified, the parenthesisation will be applied going left to right.

Restricted Characters

Atlassian has defined a list of reserved characters for JIRA Query Language which are:

space (" ") +. , ; ? | * / % ^ $ # @ [ ]

Restricted Words

Atlassian has also defined a list of reserved words for JIRA Query Language which are:

Click to See the list of words "a", "an", "abort", "access", "add", "after", "alias", "all", "alter", "and", "any", "are", "as", "asc", "at", "audit", "avg", "be", "before", "begin", "between", "boolean", "break", "but", "by", "byte", "catch", "cf", "char", "character", "check", "checkpoint", "collate", "collation", "column", "commit", "connect", "continue", "count", "create", "current", "date", "decimal", "declare", "decrement", "default", "defaults", "define", "delete", "delimiter", "desc", "difference", "distinct", "divide", "do", "double", "drop", "else", "empty", "encoding", "end", "equals", "escape", "exclusive", "exec", "execute", "exists", "explain", "false", "fetch", "file", "field", "first", "float", "for", "from", "function", "go", "goto", "grant", "greater", "group", "having", "identified", "if", "immediate", "in", "increment", "index", "initial", "inner", "inout", "input", "insert", "int", "integer", "intersect", "intersection", "into", "is", "isempty", "isnull", "it", "join", "last", "left", "less", "like", "limit", "lock", "long", "max", "min", "minus", "mode", "modify", "modulo", "more", "multiply", "next", "no", "noaudit", "not", "notin", "nowait", "null", "number", "object", "of", "on", "option", "or", "order", "outer", "output", "power", "previous", "prior", "privileges", "public", "raise", "raw", "remainder", "rename", "resource", "return", "returns", "revoke", "right", "row", "rowid", "rownum", "rows", "select", "session", "set", "share", "size", "sqrt", "start", "strict", "string", "subtract", "such", "sum", "synonym", "table", "that", "the", "their", "then", "there", "these", "they", "this", "to", "trans", "transaction", "trigger", "true", "uid", "union", "unique", "update", "user", "validate", "values", "view", "was", "when", "whenever", "where", "while", "will", "with"

Performing text searches

Text-searching features can also be used along with the CONTAIN operator when performing searches on Summary, Description, Environment, Comments, etc.

Using Field Reference

A field is a word that represents a Jira field. JQL offers search functionality for a value in a specific field.

An operator resides between a field on the left and one or more values on its right. Then, the operator compares the value and only true results are returned.

e.g. =, !=, >, >=, <, <=, IN, NOT IN, etc.

Using Keyword Reference

A keyword is a phrase or word that enables us to join two or more clauses together to form a complex JQL query. It can help alter the logic of one or more clauses, the logic of operators.

e.g. created, creator, customFieldName, description, due, environment, etc.

Using Operators Reference

An operator resides between a field on the left and one or more values on its right. Then, the operator compares the value and only true results are returned.

e.g. =, !=, >, >=, <, <=, IN, NOT IN, etc.

Developer Use Cases

There can be situations when we are building an application and it needs to be linked with our JIRA functionalities and project statuses.

Thankfully, JIRA by Atlassian also provides a stable REST API to access issues that let you use the same JQL as one would use on frontend UI.

A structured JSON will be returned which is easy to both manipulate and process.

e.g. We can run the following command in Windows/Linux/Mac.

A JSON will be returned containing the duplicate issues from the DEMO project which can easily be processed for further usage in the application we are building.

Visualize Results on your Dashboard

There exist various ready-to-use reports in all Jira Software projects. Visualize Results on your Dashboard

For team-managed projects:

  1. Firstly, we must ensure if Reports is enabled by navigating to Reports in Features which is available in Project Settings.
  2. Click on Reports available in the sidebar.
  3. Click on a report type to start report generation.

For company-managed projects:

  1. Click on Reports available in the sidebar.
  2. Click on a report type to start report generation.

Conclusion

In this article, we learned about:

  • The Search functionality in JIRA to search our issues in JIRA Dashboard
  • The `JIRA Query Language (JQL) to have complex parameterized queries answered in an easy manner
  • How we can effectively use the JIRA Query Language (JQL) in a flexible way to ease our daily operations JIRA