Confluence search - matched snippets

Is there a way in the Confluebce search API to get back only the snippets of text from the document that matched the query? i.e. instead of the entire body (all the document) to get shorter text based on the match with the query terms?

1 answer

1 accepted

0 votes
Accepted answer

Hi Shai,

While using the Confluence REST API seems to be more of a developer matter I'd like to point you to the new Developer Community that Atlassian recently launched.

To not leave you empty handed I think you can use the excerpt property of the response of your search query. This will give you an excerpt and mark the search term(s).

For example when I do a search with text~'collaboration' the API will return an excerpt like this:

"excerpt": "Interview Info Company Berlingske Media Department Consumer Sales Products SalesForce (heeft veel @@@hl@@@collaboration@@@endhl@@@ mogelijkheden) Google Drive Gmail Google …  Voordien in email marketing en hotel manager Veel @@@hl@@@collaboration@@@endhl@@@/partnering met Ad Sales Problems Observed Problems Observed Below is a list of the problems we",

As you can see the word collaboration is marked with @@@hl@@@ and @@@endhl@@@.

You can choose the excerpt strategy using the excerpt request param as documented in the Confluence REST API Docs.



Thanks! Appreciate the tip.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,312 views 93 8
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