The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence search - matched snippets

Shai Deljo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 3, 2017

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Maarten Cautreels
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 Champions.
April 3, 2017

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.

Best,

Maarten

Shai Deljo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 3, 2017

Thanks! Appreciate the tip.

TAGS
AUG Leaders

Atlassian Community Events