How to filter Jira issues by project and summary text?

Hey everyone,

I’m trying to find a way to search for Jira issues within a specific project using the summary text. I’ve been experimenting with various search functions, but I’m encountering a problem.

I assumed that the function getIssuesFromTextSearchWithProject would limit the search to a designated project, yet it returns related issues from other projects as well. For example, I’ve attempted to use the following code:

$searchResults = $jiraClient->searchIssuesByProjectAndText($token, 'MY_PROJECT', 'Summary Text', 5);

This doesn’t seem to work as expected, as it retrieves issues beyond ‘MY_PROJECT’.

Has anyone experienced something similar or found an alternative method? I’m using PHP for this task, so any insights would be greatly appreciated. Thanks!

hey surfingwave, i’ve had similar issues. have u tried using JQL (Jira Query Language)? it’s pretty powerful for filtering. u could try something like:

project = MY_PROJECT AND summary ~ “Summary Text”

this should restrict results to ur project. hope it helps!

I’ve encountered this issue before, and I found that using the Jira REST API with a specific JQL query yields more accurate results. Here’s an approach that worked for me:

Construct a JQL query that combines project and summary criteria, and then use the /search endpoint with this JQL query.

The JQL would look something like this:

project = ‘MY_PROJECT’ AND summary ~ ‘Summary Text’

This method ensures you’re only getting results from the specified project. It’s more reliable than relying on built-in functions that might have unexpected behavior. Just make sure to properly encode the JQL query when sending the API request.

I’ve dealt with this exact problem before, and I can tell you that the built-in functions can be a bit unreliable sometimes. What worked for me was using the Jira REST API directly with a custom JQL query. It gives you much more control over the search parameters.

Here’s a snippet of PHP code that I used:

$jql = urlencode("project = MY_PROJECT AND summary ~ \"Summary Text\"");
$url = "https://your-jira-instance.com/rest/api/2/search?jql={$jql}&maxResults=5";

$response = curl_exec($ch);
$issues = json_decode($response)->issues;

This approach lets you fine-tune your search criteria and ensures you’re only getting results from the project you want. Just remember to handle pagination if you need more than the default number of results. Hope this helps!