JIRA的高级搜索功能类似于SQL查询,是使用Jira查询语言(JQL)构建结构化查询来搜索问题。可以指定无法在快速或基本搜索中定义的条件(例如, ORDER BY 子句)。
注意,即使JQL使用类似SQL的语法,它也不是数据库查询语言。
为什么不能在基本搜索和高级搜索之间切换?
通常,使用基本搜索创建的查询将能够转换为高级搜索,然后再次返回。但是,使用高级搜索创建的查询可能无法转换为基本搜索,尤其是在以下情况下:
- 该查询包含一个OR运算符(请注意,您可以有一个IN运算符,它将被翻译,例如 project in (A, B))即,即使此查询: (project = JRA OR project = CONF) 等同于此查询: (project in (JRA, CONF)),也只会翻译第二个查询。
- 查询包含一个NOT运算符
- 查询包含一个EMPTY运算符
- 查询包含任何比较运算符:!=,IS,IS NOT,>,> =,<,<=
- 查询指定与项目相关的字段和值(e.g. version, component, custom fields),并且该项目未明确包含在查询中(例如 fixVersion = “4.0”,不带 AND project=JRA)。对于自定义字段,这尤其棘手,因为可以根据项目/问题类型进行配置。一般的经验法则是,如果无法以基本搜索形式创建查询,则无法将其从高级搜索转换为基本搜索。
为什么没有显示自动完成建议(auto-complete)?
通常我们在输入搜索语句的时候会有自动匹配提示的功能,或者是某个字段会直接匹配出来,但是有时明明有这个字段,却无法进行搜索可能是因为有以下原因,尤其是第三点:
- 您的管理员可能已为您的Jira实例禁用了“ JQL自动完成”功能。
- 没有为功能参数提供自动完成建议。
- 并非针对所有字段都提供自动完成建议。检查 custom fields 的 “Edit”选项中看它的“Search Template”是否支持。
JQL有以下保留的字符:
space (" ")| + | .|,|;|?| | | * |/|%|^|$|#|@|[|]
— |—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—
如果希望在查询中使用这些字符,则需要:
version = "[example]"
summary ~ "\\[example\\]"
JQL还具有保留字列表。如果您希望在查询中使用引号,则这些词必须用引号引起来(单引号或双引号)。
“abort”, “access”, “add”, “after”, “alias”, “all”, “alter”, “and”, “any”, “as”, “asc”, “audit”, “avg”, “before”, “begin”, “between”, “boolean”, “break”, “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”, “join”, “last”, “left”, “less”, “like”, “limit”, “lock”, “long”, “max”, “min”, “minus”, “mode”, “modify”, “modulo”, “more”, “multiply”, “next”, “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”, “sum”, “synonym”, “table”, “then”, “to”, “trans”, “transaction”, “trigger”, “true”, “uid”, “union”, “unique”, “update”, “user”, “validate”, “values”, “view”, “when”, “whenever”, “where”, “while”, “with”
JIRA中的系统字段。
- Affected version / Approvals / Assignee / Attachments /
- Category / Comment / Component / Created / Creator / Custom field / Customer Request Type
- Description / Due
- Environment / Epic link
- Filter / Fix version
- Issue key / Issue link type / Labels / Last viewed / Level
- Original estimate
- Parent / Priority / Project
- Remaining estimate / Reporter / Request channel type / Request last activity time / Resolution / Resolved
- SLA / Sprint / Status / Summary
- Text / Time spent / Type
- Updated
- Voter / Votes
- Watcher / Watchers / Work log author / Work log comment
Work log date / Work ratio
JQL常用的搜索函数
- approved()
- approver()
- breached()
- cascadeOption()
- closedSprints()
- completed()
- componentsLeadByUser()
- currentLogin()
- currentUser()
- earliestUnreleasedVersion()
- elapsed()
- endOfDay()
- endOfMonth()
- endOfWeek()
- endOfYear()
- everbreached()
- issueHistory()
- issuesWithRemoteLinksByGlobalId()
- lastLogin()
- latestReleasedVersion()
- linkedIssues()
- membersOf()
- myApproval()
- myPending()
- now()
- openSprints()
- paused()
- pending()
- pendingBy()
- projectsLeadByUser()
- projectsWhereUserHasPermission()
- projectsWhereUserHasRole()
- releasedVersions()
- remaining()
- running()
- standardIssueTypes()
- startOfDay()
- startOfMonth()
- startOfWeek()
- startOfYear()
- subtaskIssueTypes()
- unreleasedVersions()
- updatedBy()
- votedIssues()
- watchedIssues()
- withinCalendarHours()