private PriorityQueue<ScoreTerm> retrieveTerms(int docNum) throws IOException {
  Map<String,Int> termFreqMap=new HashMap<>();
  for (  String fieldName : fieldNames) {
    final Fields vectors=ir.getTermVectors(docNum);
    final Terms vector;
    if (vectors != null) {
      vector=vectors.terms(fieldName);
    }
 else {
      vector=null;
    }
    if (vector == null) {
      Document d=ir.document(docNum);
      IndexableField fields[]=d.getFields(fieldName);
      for (      IndexableField field : fields) {
        final String stringValue=field.stringValue();
        if (stringValue != null) {
          addTermFrequencies(new FastStringReader(stringValue),termFreqMap,fieldName);
        }
      }
    }
 else {
      addTermFrequencies(termFreqMap,vector,fieldName);
    }
  }
  return createQueue(termFreqMap);
}

private PriorityQueue < ScoreTerm > retrieveTerms ( int docNum ) throws IOException { Map < String , Int > termFreqMap = new HashMap < > ( ) ; for ( String fieldName : fieldNames ) { final Fields vectors = ir . getTermVectors ( docNum ) ; final Terms vector ; if ( vectors != null ) { vector = vectors . terms ( fieldName ) ; } else { vector = null ; } if ( vector == null ) { Document d = ir . document ( docNum ) ; IndexableField fields [ ] = d . getFields ( fieldName ) ; for ( IndexableField field : fields ) { final String stringValue = field . stringValue ( ) ; if ( stringValue != null ) { addTermFrequencies ( new FastStringReader ( stringValue ) , termFreqMap , fieldName ) ; } } } else { addTermFrequencies ( termFreqMap , vector , fieldName ) ; } } return createQueue ( termFreqMap ) ; }
find words for a more - like - this query former .
