I have the search box, search results and refinement web part set up. I want to kind of toggle, whether only the properties of an item or the properties and the content of the attachment shall be searched.

If the user searches for "ABC", he shall only see the document with title (column) "ABC". He shall not see the document with title "DEF", but "ABC" somewhere hidden in the PDF.

I couldn't find an available refiners in the refinement web part (edit -> choose refiners...). I'd like a kind of yes/no option for 'search in attachment'. Is there anything OOTB?

1 Answer 1


I guess there is no OOTB way to achieve 'Search in attachment'. With some Javascript coding you could achieve this.

  1. Create two result sources , one which queries only the Title matches and another which queries all properties and content of documents.
  2. Configure the Search results webpart to show only title matches result source.

  3. Now in the Search results page, add Javascript to change the result source based on the "Search in attachments" UI control change event.

See this blog on Dynamically Changing the Result Source . The limitation to this approach is that if refiners are used the dynamic change of result source will be neglected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.