private static boolean validateTermWithDistance ( BytesRef term , ComponentTermVector termVector ) throws IOException { if ( termVector . distances == null || termVector . distances . isEmpty ( ) ) { return true ; } else { // first check maximum for all distances for ( SubComponentDistance item : termVector . distances ) { if ( item . maximum == null ) { continue ; } else { if ( ! item . getDistance ( ) . validateMaximum ( term ) ) { return false ; } } } // then check minimum for all distances for ( SubComponentDistance item : termVector . distances ) { if ( item . minimum == null ) { continue ; } else { if ( ! item . getDistance ( ) . validateMinimum ( term ) ) { return false ; } } } // try { // System.out.println("ACCEPT: " + term.utf8ToString()+" // ("+termVector.distances.size()+")"); // for (SubComponentDistance item : termVector.distances) { // System.out.println( // item.hashCode() + "\t" + // term.utf8ToString()+"\t"+item.getDistance().getClass().getName()+"\t"+item.getDistance().minimum+"\t"+item.getDistance().maximum // + "\t" + // item.getDistance().validate(term)+"\t"+item.getDistance().compute(term)); // } // } catch (Exception e) { // System.out.println("PROBLEEM: "+e.getMessage()); // } return true ; } }
Validate term with distance .