简体   繁体   中英

Alfresco : How to search for a specific files types?

I am working to search all PNG files(ie all files which has file name extension ".png") in alfresco. I am using the followingcode, but it does not return any result:

var docs = search.luceneSearch("@cm\\:content.fileType:\"*.png\""); 
for (var i=0; i<docs.length; i++)
   {
     //TO print the name of files--> "Name: " + docs[i].name ;

   } 

I am not sure if content.fileType is the right way to code to search for file types. Any suggestion please ?

You should go with the content.mimetype query, for example: @\\{http\\://www.alfresco.org/model/content/1.0\\}content.mimetype:text/plain

https://community.alfresco.com/docs/DOC-4673-search#jive_content_id_Finding_nodes_by_content_mimetype

如果使用此语句,则仅查找PNG图像会有所帮助:

var docs = search.luceneSearch("@cm\\:name:\"png\"");

If your really want to search for PNG files you should follow Lista's approach using mimetype but with correct syntax

var docs = search.luceneSearch("@cm\\:content.mimetype:\"image/png\"");

searching for name part "PNG" ("@cm\\:name:\\"png\\"") would find any document having a token "PNG" in it's name like png.name.pdf or any_png.doc since document name is stored tokenized in the index

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM