code: public int getDoc(IndexReader reader) throws IOException {
          if (doc == -1) {
              TermDocs docs = reader.termDocs(new Term(FieldNames.UUID, id.toString()));
              try {
                  if (docs.next()) {
                      return docs.doc();
                  } else {
                      throw new IOException("Node with id " + id + " not found in index");
                  }
              } finally {
                  docs.close();
              }
          } else {
              return doc;
          }
      }
docs: Returns the document number for this score node.
  
  @param reader the current index reader to look up the document if
  needed.
  @return the document number.
  @throws IOException if an error occurs while reading from the index or
  the node is not present in the index.