This site is moving soon to become part of an integrated Appfire documentation and information site for our apps. This site will remain available during the transition to our new and improved site. Once this site is moved over, this banner will be updated with the new site link for easy access.

Take a look here! If you have any questions please email support@appfire.com

How to solve com.atlassian.jira.issue.search.ClauseTooComplexSearchException

Warning in the search regarding luceneClauseParamsLimit

"Function linksCountEqualTo returns more issues than defined by luceneClauseParamsLimit! Read more about it in our documentation https://jqlsearchextensions.atlassian.net/wiki/spaces/SEARCH/pages/1227554844/How+to+solve+com.atlassian.jira.issue.search.ClauseTooComplexSearchException"

Our functions are protected from exceeding luceneClauseParamsLimit - as a result above warning message may appear after the search. Most commonly this will happen on big Jira instances after searching for issue in linksCountEqualTo(0) or issue in linksCountLessThan(10) because they will return all issues without links or all issue with less than 10 links (which in most cases mean all issues from the instance). The solution to this problem may be using negation in your query, for example, to find all issues without links you can search: issue not in linksCountGreaterThan(0) which effectively gives same results but returns way less issues and results are not trimmed.

Error in the logs ClauseTooComplexSearchException

If JQL Search Extensions functions return 0 results and line like one below is printed to the logs:

2019-07-29 02:16:42,245 http-nio-80-exec-116 ERROR ra185165 136x31430237x9 6e0p70 153.53.2.125,192.127.253.68 /rest/issueNav/1/issueTable [c.a.j.p.i.service.issuetable.DefaultIssueTableService]com.atlassian.jira.issue.search.ClauseTooComplexSearchException: A the following query was too complex to generate a query from: {issue in functionName()}

This means you are affected by https://jira.atlassian.com/browse/JRASERVER-19350

What it means

To evaluate JQL search Jira is under the hood using Apache Lucene framework. To protect Lucene (and your Jira instance) against extremely large queries there is a limit how about of issues that can be returned by a JQL function. By default, Jira has this limit configured to 65,000 issues, so whenever the JQL function returns a bigger number of issues query will fail to evaluate and produce the logline mentioned above.

How to deal with the issue

It is possible to raise the limit by setting a Jira property named jira.search.maxclause, which however comes with a performance impact that should be tested on your installation. To better understand the impact of raising this limit please check our Performance Characteristics page (the section about jira.serach.maxclause). Generally, if your instance during a regular day work has still some spare CPU and Memory it is fine to raise the limit. 

To raise the limit please follow the steps from the official documentation on how to set a config property: https://confluence.atlassian.com/jirakb/how-to-edit-the-jira-config-properties-file-317194938.html

  1. Edit (or create if missing) jira-config.properties which should be present under Jira Home directory
  2. Search for an entry called jira.search.maxclause (if there is no such entry, then create a new one)
  3. Set the value for jira.search.maxclause to the number that will suit your instance

    jira.search.maxclauses = 120000
  4. Restart Jira and verify that problem is gone