public Map<String,Map<String,Flt>> retrieveTerms(int docNum,String[] fields,Map<String,Map<String,Flt>> fieldToTermFreqMap) throws IOException {
  if (fieldToTermFreqMap == null) {
    fieldToTermFreqMap=new HashMap<String,Map<String,Flt>>();
  }
  if (fields == null || fields.length == 0) {
    return fieldToTermFreqMap;
  }
  final Fields vectors=ir.getTermVectors(docNum);
  final Document document=ir.document(docNum);
  for (  String fieldName : fields) {
    Map<String,Flt> termFreqMap=null;
    if (fieldToTermFreqMap.containsKey(fieldName)) {
      termFreqMap=fieldToTermFreqMap.get(fieldName);
    }
 else {
      termFreqMap=new HashMap<String,Flt>();
      fieldToTermFreqMap.put(fieldName,termFreqMap);
    }
    Terms vector=null;
    if (vectors != null) {
      vector=vectors.terms(fieldName);
    }
    if (vector == null || isPayloadField(fieldName)) {
      IndexableField docFields[]=document.getFields(fieldName);
      for (      IndexableField field : docFields) {
        final String stringValue=field.stringValue();
        if (stringValue != null) {
          addTermWeights(new StringReader(stringValue),termFreqMap,fieldName);
        }
      }
    }
 else {
      addTermWeights(termFreqMap,vector);
    }
  }
  return fieldToTermFreqMap;
}

public Map < String , Map < String , Flt > > retrieveTerms ( int docNum , String [ ] fields , Map < String , Map < String , Flt > > fieldToTermFreqMap ) throws IOException { if ( fieldToTermFreqMap == null ) { fieldToTermFreqMap = new HashMap < String , Map < String , Flt > > ( ) ; } if ( fields == null || fields . length == 0 ) { return fieldToTermFreqMap ; } final Fields vectors = ir . getTermVectors ( docNum ) ; final Document document = ir . document ( docNum ) ; for ( String fieldName : fields ) { Map < String , Flt > termFreqMap = null ; if ( fieldToTermFreqMap . containsKey ( fieldName ) ) { termFreqMap = fieldToTermFreqMap . get ( fieldName ) ; } else { termFreqMap = new HashMap < String , Flt > ( ) ; fieldToTermFreqMap . put ( fieldName , termFreqMap ) ; } Terms vector = null ; if ( vectors != null ) { vector = vectors . terms ( fieldName ) ; } if ( vector == null || isPayloadField ( fieldName ) ) { IndexableField docFields [ ] = document . getFields ( fieldName ) ; for ( IndexableField field : docFields ) { final String stringValue = field . stringValue ( ) ; if ( stringValue != null ) { addTermWeights ( new StringReader ( stringValue ) , termFreqMap , fieldName ) ; } } } else { addTermWeights ( termFreqMap , vector ) ; } } return fieldToTermFreqMap ; }
find words for a more - queryfromdocuments - this query former .
