code: public PriorityQueue<Object[]> retrieveTerms(int docNum) throws IOException
     {
        Map<String, Int> termFreqMap = new HashMap<String, Int>();
        for (int i = 0; i < fieldNames.length; i++)
        {
           String fieldName = fieldNames[i];
           TermFreqVector vector = ir.getTermFreqVector(docNum, fieldName);
  
           // field does not store term vector info
           if (vector == null)
           {
              Document d = ir.document(docNum);
              String[] text = d.getValues(fieldName);
              if (text != null)
              {
                 for (int j = 0; j < text.length; j++)
                 {
                    addTermFrequencies(new StringReader(text[j]), termFreqMap, fieldName);
                 }
              }
           }
           else
           {
              addTermFrequencies(termFreqMap, vector);
           }
  
        }
  
        return createQueue(termFreqMap);
     }
docs: Find words for a more-like-this query former.
  
  @param docNum the id of the lucene document from which to find terms