SharePoint 2013 Custom Search

Shri-6058 326 Reputation points
2021-03-01T21:36:10.98+00:00

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.

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,273 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,864 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Shri-6058 326 Reputation points
    2021-03-02T02:17:28.523+00:00

    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

    0 comments No comments

  2. Amos Wu-MSFT 4,051 Reputation points
    2021-03-02T09:01:28.237+00:00

    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.


  3. Shri-6058 326 Reputation points
    2021-03-17T05:28:45.907+00:00

    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

    0 comments No comments