Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Veronica Burd 76 posts 201 karma points
    May 10, 2016 @ 07:57
    Veronica Burd
    1

    How to stop UmbracoExamine.PDF from indexing a media file?

    I've setup UmbracoExamine.PDF to index my site's PDF files. However, I have a large number of MS Word and image files as well. Whenever I rebuild the index the umbraco log file is filled with

    'UmbracoExamine.DataServices.UmbracoLogService - Provider=PDFIndexer, NodeId=239957
    System.Exception: UmbracoExamine.FileIndexer: Extension '.jpg' is not supported at this time
    

    I tried adding the "extensions=.pdf" to the relevant ExamineSettings.config as below:

      <add name="PDFIndexer" type="UmbracoExamine.PDF.PDFIndexer, UmbracoExamine.PDF" interval="10" runAsync="true"
        analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" 
      umbracoFileProperty="umbracoFile" extensions=".pdf" indexSet="PDFIndexSet"/>
    

    However this did not solve the issue. I next tried using an event handler for NodeIndexing and setting the e.Cancel to true. Again, no success.

    ExamineManager.Instance.IndexProviderCollection["PDFIndexer"].NodeIndexing += NodeIndexingPDF;
    
    
     private void NodeIndexingPDF(object sender, IndexingNodeEventArgs e)
     {
       if(!e.Fields.ContainsKey(Constants.Conventions.Media.File))
       {
         e.Cancel = true;
         return;
       }
    
       string file = e.Fields[Constants.Conventions.Media.File];
       if (!file.ToLower().EndsWith("pdf"))
         e.Cancel = true;
     }
    

    Is there any documentation for various indexing events and what happens when Cancel is set to true?

    The only way I've been able to make UmbracoExamine.PDF ignore non-PDF files is to compile my own custom version which is not ideal.

    Thanks

    Ver

  • Robert J. Bullock 386 posts 405 karma points
    May 13, 2016 @ 15:08
    Robert J. Bullock
    0

    See the same issue. Any suggestions guys?

Please Sign in or register to post replies

Write your reply to:

Draft