         # File lib/ferret/index.rb, line 402
    402:     def doc(*arg)
    403:       @dir.synchronize do
    404:         id = arg[0]
    405:         if id.kind_of?(String) or id.kind_of?(Symbol)
    406:           ensure_reader_open()
    407:           term_doc_enum = @reader.term_docs_for(@id_field, id.to_s)
    408:           return term_doc_enum.next? ? @reader[term_doc_enum.doc] : nil
    409:         else
    410:           ensure_reader_open(false)
    411:           return @reader[*arg]
    412:         end
    413:       end
    414:     end