Package de.innovationgate.wga.common.beans

Examples of de.innovationgate.wga.common.beans.LuceneIndexFileRule


            WGUtils.getOrCreateElement(luceneDBConfig, "filerules");
            //check for default filerule
            rules = (ArrayList)LuceneIndexFileRule.getRules(luceneDBConfig);
            if (rules.size() > 0) {
                //check if last rule is defaultrule
                LuceneIndexFileRule checkDefaultRule = (LuceneIndexFileRule) rules.get(rules.size()-1);
                if (!checkDefaultRule.isDefaultRule()) {
                    //last rule is no defaultRule, create defaultRule
                    LuceneIndexFileRule.addDefaultRule(luceneDBConfig);
                }
            } else {
                //no rules present, create defaultRule
View Full Code Here


                      // this indicates normally a hidden file so skip it
                      continue;
                    }
                   
                    // retrieve file rule
                    LuceneIndexFileRule rule = retrieveFileRule(db, filename);
                    if (rule.getFileSizeLimit() == LuceneIndexFileRule.FILESIZELIMIT_INDEX_NONE) {
                        // skip file
                        continue;
                    }
                    if (rule.getFileSizeLimit() != LuceneIndexFileRule.FILESIZELIMIT_INDEX_ALL) {
                      int filesize = content.getFileSize(filename);
                        // check filesize                   
                        if (filesize > (rule.getFileSizeLimit() * 1024) || filesize == -1) {
                            _core.getLog().info("Skipping file " + filename + " of content " + content.getContentKey().toString() + " - filesizelimit " + rule.getFileSizeLimit() + " kb exceeded.");
                            // 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());
                               
                                if (rule.isIncludedInAllContent()) {
                                    addUnStored(document, INDEXFIELD_ALLCONTENT, text, rule.getBoost());
                                }
                            }
                           
                        }
                           
View Full Code Here

TOP

Related Classes of de.innovationgate.wga.common.beans.LuceneIndexFileRule

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.