Limit a search bar to only one space in confluence
Asked by Oxana Ermolaeva:

Hi. I want to restrict a search bar in Service Desk space in Confluence to the articles only in this space, but when I try to enter some names of documents from other spaces, it shows them. I have used "live search macro" for creating this search field and search bar but it still gives access to documents from other spaces. I tried to edit it also in live search macro settings, I chose Service desk space, but it didn't work as well. I will be glad if you could help me. I am using Confluence Cloud, by the way.


Answers:
author: Dam
body: Hi [@Oxana Ermolaeva](/t5/user/viewprofilepage/user-id/5025042)

With the Live search macro, did you put @self in the Restrict to this Space Key param in the macro config ? It will restrict results to only the current space...

the doc of the macro is here: <https://support.atlassian.com/confluence-cloud/docs/insert-the-livesearch-macro/>

I hope it helps.

Cheers,  
Dam.

comments: author: Oxana Ermolaeva
body: [@Dam](/t5/user/viewprofilepage/user-id/722152) thank you for your prompt reply. I clicked ''edit'' the livesearch macro and it opened the right side bar with parameters, but they are a little different from the article you sent. It shows me the following

![13.09.2022_16.58.47_REC.png](https://community.atlassian.com/t5/image/serverpage/image-id/215738i98A1FAB24D040618/image-size/large?v=v2&px=999 "13.09.2022_16.58.47_REC.png")


author: Oxana Ermolaeva
body: [@Dam](/t5/user/viewprofilepage/user-id/722152) I clicked the Space field and selected Service desk space only, but it still shows me articles from other spaces.


author: Dam
body: Humm its maybe a macro from an app... Did you choose your space here in the list of spaces ? (first param of your macro here)

Choose your space and try ;) it should work... [@Oxana Ermolaeva](/t5/user/viewprofilepage/user-id/5025042)

Dam.


author: Oxana Ermolaeva
body: [@Dam](/t5/user/viewprofilepage/user-id/722152) yeah, I selected only Service desk (my space), but it still shows me articles from other spaces :((


author: Dam
body: Oups I just noticed your last comment sorry... [@Oxana Ermolaeva](/t5/user/viewprofilepage/user-id/5025042)

Ah yes the macro is a bit different than in the doc, I just checked.

I tested it also with my cloud site, its working all fine for me, if I choose "Current space" in the list and results from the current space only are displayed...

![Capture d?e?cran 2022-09-13 a? 16.07.45.png](https://community.atlassian.com/t5/image/serverpage/image-id/215743i87BA52F396F2ACF4/image-dimensions/222x422?v=v2 "Capture d?e?cran 2022-09-13 a? 16.07.45.png")


author: Oxana Ermolaeva
body: [@Dam](/t5/user/viewprofilepage/user-id/722152) yes, I tried both with setting "current space" and then also by the name of the space. I\`m wondering what the reason can be here.


author: Oxana Ermolaeva
body: [@Dam](/t5/user/viewprofilepage/user-id/722152) May I also ask you one additional question? It's about the connection between Jira **Service Desk** **project** and this **Service Desk space** in Confluence. As I got it from my settings they are connected. Because when I open Knowledge base page in Help Desk project in Jira, it sends me to Help Desk space in Confluence. So, do I get it right that if I can search documents from other spaces in Confluence, customers can also search the same documents in Jira by using search bar in KB? And if I restrict searching only in one space, they also will be able to search only in one space, right?


author: Dam
body: Its all based on permissions, so yes if you restrict searching only in one space, customers also will be able to search only in one space. [@Oxana Ermolaeva](/t5/user/viewprofilepage/user-id/5025042)


author: Dam
body: \> yes, I tried both with setting "current space" and then also by the name of the space. I\`m wondering what the reason can be here.

Just to be sure... Did you publish the page after changing the macro param ? You need to change the param of the macro and then publish the page to update it, and then test the search... [@Oxana Ermolaeva](/t5/user/viewprofilepage/user-id/5025042)

It's strange cause if there was a bug with this macro it should be for all atlassian site not only you...


author: Oxana Ermolaeva
body: [@Dam](/t5/user/viewprofilepage/user-id/722152) permissions? You mean not just restricting the livesearch macro bar, do I have to make restriction to access? Only in confluence or in Jira as well? I\`m new to services, so please can u provide details how to make it. Thanks.


author: Oxana Ermolaeva
body: [@Dam](/t5/user/viewprofilepage/user-id/722152) No, I didn\`t publish because I thought it automatically saves changes. Besides, when I checked changes it was set to Current space even though I didn\`t publish it yet. I will try, thank you.


author: Dam
body: if you change the param in the live search macro then publish the page, and then test on the page the search, it should work ;) results of the current only will be displayed [@Oxana Ermolaeva](/t5/user/viewprofilepage/user-id/5025042)

permissions are on the space level, for users and groups... so you dont need to check permissions on the live macro itself.

Dam.


author: Alli Shea
body: Hi [@Oxana Ermolaeva](/t5/user/viewprofilepage/user-id/5025042)

There are two other ways to search within a space, in addition to the live search macro.

1. Go to the search bar on the top right of your page, and see the "Filter by Space" area. Select the space you want to search within.

![Screen Shot 2022-09-13 at 9.56.41 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/215802iC4BB2029D7FF039A/image-dimensions/256x216?v=v2 "Screen Shot 2022-09-13 at 9.56.41 AM.png")

2. You could also go to the page tree (the left panel of a space) and select "Pages" section. This would bring you to a space-specific search that is limited only to content in that space.

![Screen Shot 2022-09-13 at 9.57.10 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/215803i716DB1AE41F8782F/image-size/large?v=v2&px=999 "Screen Shot 2022-09-13 at 9.57.10 AM.png")

Hope this helps!


Tags: cloud

confluence-cloud

search