Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top