Package de.innovationgate.wgpublisher.lucene.analysis

Examples of de.innovationgate.wgpublisher.lucene.analysis.FileHandler


    }
   
    public void addFileHandlerMapping(String extension, String handlerClassName) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
      log.info("Registering filehandler for extension '" + extension + "' - '" + handlerClassName + "'.");
      Class fileHandlerClass = getLibraryLoader().loadClass(handlerClassName);
        FileHandler handler = (FileHandler) fileHandlerClass.newInstance();
        fileHandlerMappings.put(extension.toLowerCase(), handler);
  }
View Full Code Here


    public FileHandler getFileHandlerForExtension(String extension) {
        return fileHandlerMappings.get(extension.toLowerCase());
    }
   
    public boolean hasFileHandler(String extension) {
      FileHandler handler = getFileHandlerForExtension(extension);
      return handler != null;
    }
View Full Code Here

                            // file not found or filesize exceeded limit - skip file
                            continue;
                        }
                    }
                    // try to retrieve filehandler
                    FileHandler handler = retrieveFileHandler(filename);
                    if (handler == null) {
                        _core.getLog().info("No filehandler found for file " + filename + " of content " + content.getContentKey().toString() + " from db " + db.getDbReference() + ".");
                        continue;
                    } else {
                        // parse text from file
                        InputStream is = content.getFileData(filename);
                        if (is != null) {
                            String text = null;
                            try {
                                handler.parse(is);
                                text = handler.getText();
                            } catch (FileHandlerException e) {
                                _core.getLog().error("Unable to extract text from file '" + filename + "' of content '" + content.getContentKey().toString() + "' using filehandler '" + handler.getClass().getName() + "'.", e);
                            }
                            if (text != null) {
                                // index file text
                                _core.getLog().info("Indexing file " +filename + " of content " + content.getContentKey().toString() + " from db " + db.getDbReference() + ".");
                                addUnStored(document, INDEXFIELD_ALLATTACHMENTS, text, rule.getBoost());
View Full Code Here

TOP

Related Classes of de.innovationgate.wgpublisher.lucene.analysis.FileHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.