Document definition in information retrieval
For a formal definition of document in the Information Retrieval context, you can look at IR glossaries.

A common definition is:


Document:  Specific unit of retrieval (usually text). It can be a web page, an article, a book, a section or chapter.


(see for example the Glossary of the book Modern Information Retrieval by 
Ricardo Baeza-Yates and Berthier Ribeiro-Neto)