Help using proximity search

According to the documentation, I can do a proximity search to find words within a certain distance of each other. The example is simply

"atlassian jira"~10
I'm assuming that I can use a field in conjunction, but when I try this:
summary ~ "html5 credit card"~2
I get an error: Error in the JQL Query: Expecting either 'OR' or 'AND' but got '~'. (line 1, character 30)
Can someone please explain how to correctly do this kind of search?

1 answer

The thing to note is the second term needs to a string, so the whole expression should be quoted. One of the confusing things is there quoting for the search expression and then there is quoting for the JQL. The outer quote is for the search expression. The tilde in the string is interpreted by JQL.

project = ANSWERS AND summary ~ '"emails event"~5'

Well, it's not giving me any errors, but it also isn't returning anything. Maybe I don't understand how it's supposed to work. Example: I have a ticket with this in the summary - "Actual Behavior: Crazy Cheese pizza is no longer available, however, if a user places an order from their Favorite Items and the pizza = crazy cheese pizza, then the order gets placed for a pizza type no longer available."

I would have thought that the search

summary ~ '"Crazy pizza"~25'

would return that ticket. But it's not. Can you clarify?

For the expression to be true all the "pizza" words must be within 25 words of the word "Crazy". So, if I counted correctly, last "pizza" word is 32 words from the first "crazy" word. My counting might be off by one, but it does change the result.

You might be looking for

summary ~ crazy AND summary ~ pizza

I tried your example on jira.atlassian.com using the DEMO project and it worked fine. I was thinking it was an and condition, but it looks like an OR condition.

project = DEMO and summary ~ '"Crazy pizza"~25'

I don't know what to tell you. I tried changing the number to 40 so that it would encompass the 32 word distance you mention two comments up, and it didn't work. I tried adding a project into the query, and it still doesn't work. It's not giving the error anymore, but it's not returning any results. Is there some kind of configuration that needs to be done to allow this type of searching?

Hmmm.... What is your version of your Jira system? Can you try it on jira.atlassian.comin the demo project? The issue I created was DEMO-2865.

We're on 5.2. But per the documentation I linked in the OP, proximity search is supported.

There was some JQL behavioral changes, but I do not remember which version it occured in. I would try a simplier case (no repeating words) and see if you can make it work. I still recommend trying the search out on jira.atlassian.com, so you know for sure that it does work.

Hello Norman,

The single quote find was great. I had it resolve an issue with a proximity search invalid JQL syntax . I was curious how you came across the info?

Thanks,

Ramiro Castro

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

98 views 0 1
Join discussion

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