Help using proximity search

Esther Strom, ACP-JA January 16, 2014

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

1 vote
Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 18, 2014

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'

Esther Strom, ACP-JA January 19, 2014

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?

Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 20, 2014

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

Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 20, 2014

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'

Esther Strom, ACP-JA January 21, 2014

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?

Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2014

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.

Esther Strom, ACP-JA January 22, 2014

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

Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2014

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.

jose_castro January 28, 2015

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

sin8 March 2, 2021

Hello,

Is there any new information how to use the proximity search?
I'm having the same problem with confluence server.
cql=(title~'"document title"~3')
doesn't find the document with the title.

Confluence 7.11.0

Thanks

Suggest an answer

Log in or Sign up to answer