Either! It depends on the circumstances. Web-searching is a typical example of indexing external documents: the Texis crawler extracts information about the pages and builds an index (database) based on that; search results consist of links to those pages. On the other hand, in an auction application, the original information typically exists entirely within the database: users input their listings directly into the database; and search results consist of links to records within the database.