S-JQL Relations: ancestor vs ancestorOrIssue

This question is related to using ancestor vs. ancestorOrIssue in S-JQL: when would I use one over the other?

I built the following query:

issue in structure("Enterprise Portfolio", "[project in (projectA,projectB,projectC,projectD,projectE,projectF,projectG,projectH,projectI)] and ancestor in [project in (port,prog) and 'Business Area' in (Credit)]") ORDER BY key ASC

Here’s what I think this query means:

  • - The issue is in the Enterprise Portfolio structure and
  • - The issue is in one of the Credit projects and
  • - One of the issue’s ancestors is in either the Portfolio or Program project with the Business Area set to Credit

This query brought back 376 results.

I then tried this query:

issue in structure("Enterprise Portfolio", "[project in (projectA,projectB,projectC,projectD,projectE,projectF,projectG,projectH,projectI)] and ancestorOrIssue in [project in (port,prog) and 'Business Area' in (Credit)]") ORDER BY key ASC

I thought this second query would return the exact same results as the first query, because an issue can’t be in one of the Credit projects and in either the Portfolio or Program projects with the Business Area set to Credit (the Business Area field only exists in the PORT and PROG projects). But this query brought back 223 results. I tried comparing the results, but I don’t see why there’s a difference in the query results.

Can you clarify the usage of these relations, and update the Structure user guide with more examples?

Thanks!

Michelle Lekens

3 answers

This widget could not be displayed.

Hi Igor,

We did a full re-index of JIRA, and re-ran my two queries in Issue Navigator. I got the same number of results back (the number of results for each query did not change after the re-index). I then ran your suggested JQL query, and got 0 (zero) results back. Let me know if there are any troubleshooting steps you'd like for me to take. Thanks for responding so quickly!

This widget could not be displayed.

Michelle,

Thanks for the information and sorry for the inconvenience. It's hard to tell at this point what problem causes this, but the suspect now is the S-JQL implementation. For troubleshooting, it would be perfect if you could reproduce the problem on a test structure of a smaller size, like 10-20 issues (for example, by taking the first issues of the original structure); if it's hard, it's OK if you use the original one. Please do the following:

  1. Open in text editor file log4j.properties located in the JIRA installation directory and add the following lines to the end:
    ######################################################################
    # S-JQL
    ######################################################################
    
    log4j.appender.structurejql=com.atlassian.jira.logging.JiraHomeAppender
    log4j.appender.structurejql.File=structure-jql.log
    log4j.appender.structurejql.Threshold=TRACE
    log4j.appender.structurejql.MaxFileSize=20480KB
    log4j.appender.structurejql.MaxBackupIndex=1
    log4j.appender.structurejql.layout=org.apache.log4j.PatternLayout
    log4j.appender.structurejql.layout.ConversionPattern=%d %t %m%n
    
    log4j.logger.com.almworks.jira.structure = DEBUG, filelog, console
    log4j.additivity.com.almworks.jira.structure = false
    
    log4j.logger.com.almworks.jira.structure.jql = TRACE, structurejql
    log4j.additivity.com.almworks.jira.structure.jql = false
  2. Restart JIRA.
  3. Go to the Issue Navigator and run the two S-JQL queries (with ancestor andancestorOrIssue.)
  4. Open Administation | System | Atlassian Support Tools and switch to Support Zip tab. Select options Application Properties, Thread Dump, JIRA Application Logs, Tomcat Logs, Limit File Sizes. Unselect all other options. Click Create.
  5. Send the resulting file to support@almworks.com for inspection.

Please note that these log settings will persist between JIRA startups. In order to switch off extensive logging for S-JQL, you'll need to revert the changes to log4j.properties file and restart JIRA again.

Again, I apologize for the inconvenience. I'm sure we'll be able to work out a solution.

This widget could not be displayed.

Hello Michelle,

your understanding of these two relations is right. Indeed, the difference between these two queries should be that the second one matches also those issues that are both in projectA..projectI and in either of projects "prog" or "port" and have 'Business Area' set to 'Credit'. If none of projectA..projectI is "prog" or "port", there must be no difference. Moreover, even if these two queries returned different results, the second one should never return less issues than the first one.

What you observe looks like either a bug in the S-JQL implementation or a broken Lucene index (which is used for JIRA's own JQL search.) To eliminate the possibility of the latter, could you please do a full rebuild of JIRA index? (The one that requires JIRA lock, not the "background re-index" — there are cases when it's not enough.) Afterwards, could you please recheck the results of running these two queries in the Issue Navigator?

If you still observe this behaviour, please run a JQL search

project in (projectA,projectB,projectC,projectD,projectE,projectF,projectG,projectH,projectI) and project in (port,prog) and 'Business Area' in (Credit)

and report here the number of issues returned.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

425 views 3 17
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you