How do I do a text search for exact words?

Rob Wiskow April 8, 2012

I need to search for issues that contain a specific term, that is often part of a longer word. For instance, I want to find all issues that mention "foo", but don't want it to trigger on issues that mention "fools" or "food" or "footers".

5 answers

1 accepted

5 votes
Answer accepted
m
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.
April 9, 2012

Rob,

OK, I've been trying several permutations. We don't support regex queries. We are using the Lucene Search Syntax behind the scenes. I tried to go one step further and do an exact phrase match. The idea being if I could find the word "foo" followed by a space I could perhaps come up for a work around for your issue. Eventually, through testing, i found that in JIRA 5.0 we cannot search and match an exact phrase.

https://jira.atlassian.com/browse/JRA-9240

Some of the limitation is due to Lucene -- though I'm not a programmer by trade.

https://jira.atlassian.com/browse/JRA-5567

You can vote for these issues to push them up in the queue.

At the vary least, we should explain this limitation in the documentation some where. It took a bit of looking for me to get my head around the problem. I'll re-read everything to find out if I missed a call out of this issue by skimming too much.

I apologize for not finding a better answer than this.

Mary

0 votes
GilesG April 9, 2012

Hi Rob (and thanks for highlighting the issue in the documentation Mary),

What you might be experiencing is 'word stemming', which wasn't documented in our official JIRA documentation until a few hours ago (so apologies for that).

To disable this feature in JIRA, your JIRA administrator will need to switch JIRA's Indexing language option to 'Other', as decribed on the Configuring JIRA Options page of the documentation, which has also been recently updated.

Be aware that doing this will also make JIRA index 'reserved words', which means these words will become searchable.

If you change JIRA's Indexing language option to 'Other' or anything else, you will need to re-index JIRA for that change to take place.

Cheers,

Giles.

Deleted user June 24, 2013

Is there an option to do this optional? The user should have both options for search. Like:

Find all issues where the Summary contains the exact phrase "full screen"

summary ~ "\"full screen\""

But even here we get also issues which have only part of this words.

Like # people like this
0 votes
m
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.
April 9, 2012

Rob,

Ah, ok, maybe the answer is using the reserved characters:

I'm testing it on 5.0 now. I'll see if I can get what you want.
Mary
0 votes
m
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.
April 9, 2012

Hi Rob,

I see your pain. I tested the syntax that I gave you so I've seen it working. I found the best way to troubleshoot is to build up the query. Have you tried that?

project = ProjectName

then

project = ProjectName AND description ~ "foo"

then

project = ProjectName AND description ~ "foo" and description ~ "foobar"

Can you also tell me which version of JIRA you are running? That might help me debug.

Mary

Rob Wiskow April 9, 2012

We're currently running Jira 4.4.1.

What we really need is just an "end of word" character, like a regex $.

I've just been trying something as simple as "summary ~ "foo"", and trying to get it to exclude all matches on anything longer than "foo"

0 votes
m
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.
April 8, 2012

Rob,

You can use the advanced searching in JIRA to do this. The page that documents what you can do with advanced search is here:

http://confluence.atlassian.com/display/JIRA/Advanced+Searching

Effectively, you need a syntax like this:

project = MYPROJ AND description ~ "foo" AND NOT description ~ "foobar"

Mary

Rob Wiskow April 9, 2012

I and several of my team members have been over that doc extensively and have not figured out how to make it work. The closest we've gotten is something akin to:

"foo" NOT ("fool" OR "fools" OR "food" OR "foot" OR "footer" ...)

which you can see is not really a solution

Suggest an answer

Log in or Sign up to answer