none
SharePoint Search only for contents that are linked as content within a page RRS feed

  • Question

  • Say I have the following content:

    Pages Library

    • UsefulDocuments.aspx
    • ArchivedDocuments.aspx

    Documents Library

    • UsefulDoc1.doc
    • UsefulDoc2.doc
    • ArchivedUsefulDoc1.doc
    • ArchivedDoc1.doc

    My pages then contain the following hyperlinks within their Page Content

    UsefulDocuments.aspx

     

    ArchivedDocuments.aspx

    How do I go about searching within the contents of a specific page? For example, I want to search only the Page Contents of ArchivedDocuments.aspx and return only purely archived documents (e.g. ArchivedDoc1.doc).

    I know that the easiest way would be to create a custom columns for tagging the Documents as Archived/Useful. However for reasons, I am unable to go with that approach for now as there are too many things to consider in the Production setting as the contents linked are stored all over the place (different subsites, different libraries, etc.).

    What are the ways to go about searching page specific content?

    Friday, August 23, 2019 3:26 AM

All replies

  • Hi,

    If you want to search contents in a specific page, you could add a managed property path in your query.

    You could try to use this query in your search:

    ArchivedDoc1.doc path:http://sp/SitePages/ArchivedDocuments.aspx

    Best Regards,

    Michael Han


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, August 26, 2019 8:18 AM
  • Hello, thank you for the suggestion. I tried it out (uploaded a different file and used a different page, but essentially same process), and unfortunately, it only returned to me the page itself, not the related file / page.

    Here is the result:

    My page contains this:


    • Edited by OCS.New Monday, August 26, 2019 12:54 PM
    Monday, August 26, 2019 12:53 PM
  • returning of page content is the only option if we talk about OTB solution. If you want to get archived documents in separate search results you have few options:

    1. customize search results on javascript side e.g. via custom search processor: Enhance your Search results with a Post Processor

    2. like you wrote add new site column (IsArchived), add it to your document libraries, set to true it's value for archived documents, recrawl site and use appropriate managed property for getting archived documents from search: IsArchived=1


    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - https://github.com/sadomovalex/camlex

    • Proposed as answer by Michael Han6 Thursday, August 29, 2019 9:18 AM
    Monday, August 26, 2019 3:06 PM
  • Hi,

    I agree with sadomovalex. If you think his reply is helpful, you could mark it as an answer.

    Best Regards,

    Michael Han


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, September 2, 2019 8:54 AM
  • Hi,

    Is there anything to update? 

    Please remember to mark the reply as an answer if it helps. 

    Have a nice day!

    Best Regards, 

    Michael Han 


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, September 4, 2019 8:24 AM