question

Shri-6058 avatar image
0 Votes"
Shri-6058 asked ·

SharePoint 2013 Custom Search

Hello, I have a subsite document library having 5000 documents. I also have a SP webpart(server control) to display custom result based on custom parameters.

The documents were also displayed in the global search. I was asked to not to show documents in global search. I defined the rule to exclude the library for the document library but the documents are not returning results even within my application. It looks like SP search requires crawling content in order to display results even with object model. Having said that how do I block showing these content from the Global search?

Please advise.

office-sharepoint-server-administrationoffice-sharepoint-server-search-itpro
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Shri-6058 avatar image
0 Votes"
Shri-6058 answered ·

Appreciate any customization on subsite search hiding from global search. I am using Search API and hence I can exclude the subsite indexing and crawling

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AmosWu-MSFT avatar image
0 Votes"
AmosWu-MSFT answered ·

You could try to custom SharePoint 2013 search template. There is a ctx.CurrentItem.Path property in the search template. You could compare the current site url with the value of ctx.CurrentItem.Path to decide whether to display the current item.
73348-image.png
Steps To Create Custom Display Templates In SharePoint 2013


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


image.png (23.4 KiB)
· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Shri-6058,
I am checking to see how things are going there on this issue. Please let us know if you would like further assistance.
You can accept the helpful post as answer to help other community members find helpful information quickly.
You can also share your own solution here and mark it as answer, and we can learn from each other.

0 Votes 0 ·
Shri-6058 avatar image
0 Votes"
Shri-6058 answered ·

Thank you for the follow up. I am only concerned on using custom search in main SharePoint 2013 Global search using custom template. If it is only for subsite or any site collection.

Do you suggest to modify the _layouts schema file? how to edit ctx.CurrentItem.Path ?

I am still working on solutions. My SP 2013 on-premises search shows results in the search result page even when user doesnt have permission. I am trying to find if there are any hotfix or known issue. My plan was to remove everybody's permission from the document library, so the result wont appear except site collection administrators. I tried to develop my custom application to call and return search results using impersinating/administrator access. I am stuck at what SharePoint search result strange behavior. Please let me know if you have any suggestions

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.