4

I have a Sharepoint Document repository site, but when I am typing anything on the Search box, not only it searches for Files and Folders it also searches the document content and returns the documents, I don't want this as I have too many documents and the search results are getting very confusing. I did a Reset Index and then a full crawl but nothing helped.Please suggest how to exclude document content from the search sources.

4
  • you should use the content search web part and define your custom query
    – Nk SP
    Mar 13, 2015 at 12:41
  • Well, I have document Web Part and there is a search box by default so it will be impossible for me to prevent users from using the default search box for the document library. I need sharepoint to stop crawling the contents of the files to start with!
    – Ria
    Mar 13, 2015 at 12:48
  • DO you want completely block the files from search or you want user can search the file names but no content? is their any special file type which you want block? is this for all site collections or one subsite or ?
    – Waqas Sarwar MVP
    Mar 13, 2015 at 12:49
  • I just want, if an user searches with a key word, it should only return the Folders or files and not the documents/files which is has the key word somewhere in the content of the document.
    – Ria
    Mar 13, 2015 at 12:52

3 Answers 3

2

You could setup the query for you search results web part so that you use something like Title:{searchboxQuery}.

This would only return results where the title of the content contains the searched term.

1
  • Additionally, I would also include the file name part of the search query as not many people set the title. Most people still identify documents by file name.
    – sssreddy
    Jan 24, 2019 at 15:13
1

I don't know how many document libraries you are dealing with, but if they are only a few, you can restrict the search engine from indexing the document library. This setting is accessed via Advanced Setting on the document library. From there, you simply check NO to:

Allow items from this document library to appear in search results?

This setting is shown below:

enter image description here

0

You could create a result source that transforms user queries accordingly.

Filename:{searchBoxQuery} OR Title:{searchBoxQuery} might be a good start. Afterwards, set the newly created result source as the default one. Depending on the intended scope, you can either create the result source on SSA level, site collection level or site level.

As per https://support.office.com/en-us/article/Understanding-query-transforms-B31631A5-0C1F-436E-8061-FD807BB96AE1, using a result source ensures that "transform changes will not be discarded or overridden, because the result source transforms the query last."

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.