private void analyzeTextTable ( String toplevelCorpusName ) { List < String > rawTexts = getQueryDao ( ) . getRawText ( toplevelCorpusName ) ; // pattern for checking the token layer final Pattern WHITESPACE_MATCHER = Pattern . compile ( "^\\s+$" ) ; for ( String s : rawTexts ) { if ( s != null && WHITESPACE_MATCHER . matcher ( s ) . matches ( ) ) { // deactivate doc browsing if no document browser configuration is exists if ( getQueryDao ( ) . getDocBrowserConfiguration ( toplevelCorpusName ) == null ) { // should exists anyway Properties corpusConf ; try { corpusConf = getQueryDao ( ) . getCorpusConfiguration ( toplevelCorpusName ) ; } catch ( FileNotFoundException ex ) { log . error ( "not found a corpus configuration, so skip analyzing the text table" , ex ) ; return ; } // disable document browsing if it is not explicit switch on by the // user in the corpus.properties boolean hasKey = corpusConf . containsKey ( "browse-documents" ) ; boolean isActive = Boolean . parseBoolean ( corpusConf . getProperty ( "browse-documents" ) ) ; if ( ! ( hasKey && isActive ) ) { log . info ( "disable document browser" ) ; corpusConf . put ( "browse-documents" , "false" ) ; getQueryDao ( ) . setCorpusConfiguration ( toplevelCorpusName , corpusConf ) ; } // once disabled don't search in further texts return ; } } } }
Searches for textes which are empty or only contains whitespaces . If that is the case the visualizer and no document visualizer are defined in the corpus properties file a new file is created and stores a new config which disables document browsing .