1

I am attempting to search a SharePoint instance using the search api. I have two files in a document library called AddDoc.docx and AddPic.png.

However, when I search using Add* only AddDoc.docx is returned in the results.

The URL for search I am using is:

http://myserver/sites/mysite/_api/search/query?querytext='(Filename:Add*)'

The requirement is to only search on the name of the file, not title or content etc.

I did find and follow this regarding adding managed file types to the search index. I have added png and forced a full crawl on the content source as described in the link. I even waited 24 hours and still no png returned. The content source is set for continuous crawl.

I have tried Filename:* and the png is not returned. I have also tried the following URL to rule out the Filename filter, but again only the docx is returned:

http://myserver/sites/mysite/_api/search/query?querytext='(path:"http://myserver/sites/mysite/myLib/")'

Finally I tried the following in case there was and issue with png and querytext but still no png returned:

http://myserver/sites/mysite/_api/search/query?querytemplate='Filename:add*'

When I perform the same search through the SharePoint website search box with Add*, both files are returned.

Am I missing some configuration somewhere?

Edit the call is being made from a separate website that exists on the same domain as the SharePoint server.

1

OOTB the png filetype is not a default filetype.

See this list of OOTB filetypes: Supported file types

Try adding it to The Managed File Types. To add a file name extension to the Manage File Types page

To add a file name extension to the Manage File Types page

 1. Verify that the user account that is performing this procedure is an
    administrator for the Search service application.
 2. In Central Administration, in the Application Management section,
    click Manage Service Applications.
 3. On the Manage Service Applications page, in the list of service
    applications, click the Search service application.
 4. On the Search Administration page, in the Crawling section, click
    File types. The Manage File Types page appears.
 5. Click New File Type.
 6. In the File extension box, type the extension of the file type that
    you want to add.
 7. Click OK.
 8. Verification: make sure that the extension appears in the list of
    file types on the Manage File Types page.

The steps above are taken from the linked article.

After you have done this. Wait for a full crawl and then try to search for you png files.

  • Thanks for the suggestion, I had already followed that article and no joy (I forced a full crawl and tried, even waited 24 hrs after crawl completion and still not returned). I will make it more obvious in the question that that has already been followed. – A.W. Sep 6 '18 at 10:08
  • If your environment is a developingenvironment try resetting your search index. – Johan Brännmar Sep 6 '18 at 10:33
  • Thank Johan, that did the trick - resetting the index and then forcing a full crawl again resulted in the png being returned. Any ideas as to why a complete index reset was required? Obviously, in production this wouldn't be an ideal solution. I suppose it could simply be one of those occasions when it just did need it. – A.W. Sep 6 '18 at 10:50
  • Maybe its not the ideal solution as you say, But in some cases you need to reset the index any way. – Johan Brännmar Sep 6 '18 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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