Reputation: 151
I am working to search all PNG files(i.e. 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 ?
Upvotes: 0
Views: 939
Reputation: 2707
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
Upvotes: 0
Reputation: 151
If I use this statement, it helps to find only PNG images:
var docs = search.luceneSearch("@cm\\:name:\"png\"");
Upvotes: 0
Reputation: 2246
You should go with the content.mimetype
query, for example: @\{http\://www.alfresco.org/model/content/1.0\}content.mimetype:text/plain
Upvotes: 1