首页 > 解决方案 > 对于大于 2-3MB 的文件大小,Apache tika 解析非常慢

问题描述

我们正在使用 apache tika 1.24 版本来检测和提取各种文件数据,此代码适用于较小的文件,但无法提取 2-3mb 文件的数据。对于较大尺寸的文件,是否有人遇到过这个库的问题?

private void validate(stream: TikaInputStream) {

            val parser   = new AutoDetectParser();
            val handler  = new BodyContentHandler(-1);
            val metaData = new Metadata();
            val context = new ParseContext();
            val pdfConfig = new PDFParserConfig();
            pdfConfig.setExtractInlineImages(true);
            pdfConfig.setExtractUniqueInlineImagesOnly(true);
            context.set(classOf[PDFParserConfig], pdfConfig);
            context.set(classOf[EmbeddedDocumentExtractor], new EmbeddedImageFinder(t));
            parser.parse(stream, handler, metaData, context);
              val content       = handler.toString();

  }

标签: apache-tika

解决方案


推荐阅读