title: Alfresco : How to search a mimeType of file using 'lucensearch'
body: <p>I have written the following javascirpt code snipped in <strong>Alfresco CMS</strong> to find and print  names of files whose  <strong>mimetype is "image/png"</strong> into a book.txt file. This code creates the book.txt file successfully, but it is blank; it does not write any name of files whose mimeType is "image/png", though there are more than 100 png images files with  mimetype 'image/png':</p>
  
  <pre><code>var logFile = space.childByNamePath("book.txt");
  if (logFile == null)
  {
     logFile = space.createFile("book.txt");
  }
  if (logFile != null)
  {
    var docs = search.luceneSearch("content.mimetype:'image/png'");
     var log = "";
     for (var i=0; i&lt;docs.length; i++)
     {
        log += "Name: " + docs[i].name + "\tPath: " + docs[i].displayPath + "\r\n";
     }
     logFile.content += log;
  }
  </code></pre>
  
  <p>Any suggestion what is the wrong with this code. I have put this code inside "company home>Data Dictionary>script" and I am running this script from "company home>Sites" which is root of all contents. Hence it is the root of all folders which contains images files.
  Please advise.</p>