code: public TermDocs termDocs(Term term) throws IOException
     {
        if (term!=null && term.field() == FieldNames.UUID)
        {
           // check cache if we have one
           if (cache != null)
           {
              DocNumberCache.Entry e = cache.get(term.text());
              if (e != null)
              {
                 // check if valid
                 // the cache may contain entries from a different reader
                 // with the same uuid. that happens when a node is updated
                 // and is reindexed. the node 'travels' from an older index
                 // to a newer one. the cache will still contain a cache
                 // entry from the old until it is overwritten by the
                 // newer index.
                 if (e.creationTick == creationTick && !isDeleted(e.doc))
                 {
                    return new SingleTermDocs(e.doc);
                 }
              }
  
              // not in cache or invalid
              TermDocs docs = in.termDocs(term);
              try
              {
                 if (docs.next())
                 {
                    // put to cache
                    cache.put(term.text(), this, docs.doc());
                    // and return
                    return new SingleTermDocs(docs.doc());
                 }
                 else
                 {
                    return EmptyTermDocs.INSTANCE;
                 }
              }
              finally
              {
                 docs.close();
              }
           }
        }
        return termDocsCache.termDocs(term);
     }
docs: If the field of <code>term</code> is {@link FieldNames#UUID} this
  <code>CachingIndexReader</code> returns a <code>TermDocs</code> instance
  with a cached document id. If <code>term</code> has any other field
  the call is delegated to the base <code>IndexReader</code>.<br>
  If <code>term</code> is for a {@link FieldNames#UUID} field and this
  <code>CachingIndexReader</code> does not have such a document,
  {@link EmptyTermDocs#INSTANCE} is returned.
  
  @param term the term to start the <code>TermDocs</code> enumeration.
  @return a TermDocs instance.
  @throws IOException if an error occurs while reading from the index.