Generally, a website like an e-commerce website, and usually also news websites, blogs and anything else with highly structured pages (such as Stack Overflow itself -- though don't try looking for it), will publish an XML sitemap file.
An XML sitemap is basically just a big XML file with a bunch of links to all of the pages in the site. It usually also includes the relative "importance" of each page within the site (so a product page is more important than a category listing, for example) which helps the search engine to decide what to prefer to display in a result page.
Because the sitemap.xml file may be really big (several megabytes for a large site), Google and other search engines also accept more specialized sitemap files. For example, a "News Sitemap" will contains links to all news stories published by a news website in the last 48 hours. Google will "ping" that file much more frequently (even up to once every couple of minutes) to check whether new stories have been published -- this is how they keep http://google.com/news up-to-date.
Note that the sitemap file only contains links to pages within the site. It's not a dump of the database or anything like that. This is because search engines are specifically interested in indexing a site the same way that human would read it. That's why they put so much emphasis on penalizing you from "tricking" it into indexing something a human would never actually see (hidden text and whatnot).
In response to your question, for the "internal" search functionality, yes most of these will be implemented using a direct search of the database, rather than the typical "public" search engine technique of crawl/index/query.
To make the searching faster, typically something like Lucene is used (some databases provide in-built full-text search functionality as well, but Lucene is more full-featured than any in-built full-text search I've seen). Basically, what comes out of a Lucene search will be the identifier of the products/blog post/news item your query matched, and then you'll fetch those results from the database to display however you like.
However, that can be fairly complex to set up. Many sites will just use something like a Google Custom Search, which basically just does a regular Google search with "site:example.com" pre-pended to the query string. It usually returns worse results than Lucene, but it's pretty trivial to set up.