Facebook (Nasdaq: FB) finally had a good week this summer. The leading social-networking website operator saw its stock post an impressive 16% gain on the week. Aside from a pair of weekly 11% and 10% gains in early June, Facebook's been largely a losing bet since going public at $38 in May.

The general market did rally as well, but this wasn't a run fueled by tech. The stodgy Dow Jones 30's 2.2% pop beat the Nasdaq's 1.5% advance, meaning that the Federal Reserve's QE3 push did more for blue chips than the iPhone 5 did for technology companies.

Facebook earned its upticks. Will it keep them?

Searching for clues
The only major Facebook-centric development this week was CEO Mark Zuckerberg's appearance at the TechCrunch Disrupt conference. Beyond some humbling admissions of what the company has done wrong, the young helmsman has made it clear that Facebook realizes there's a huge opportunity in search.

In news that has to leave Google (Nasdaq: GOOG) quivering, Zuckerberg revealed that Facebook is fulfilling roughly a billion search queries a day and it's "not even trying." What happens when Facebook truly turns on the charm?

"Search engines are really evolving toward giving you a set of answers," Zuckerberg said, and he's not talking about the type of general questions that IAC's (Nasdaq: IACI) Ask.com has been responding to for years. He's thinking more along these lines:

  • What sushi restaurants have my Facebook friends gone to lately and liked?
  • I have a job interview at a certain company -- do any of my friends work there so I can find out what it's like?
  • Have any of my friends stayed at a hotel worth recommending in New York City?

Zuckerberg is just dreaming out loud right now, but he revealed on Tuesday that Facebook does have a team working on search.

Taking search to the next level
This was bound to happen. Even though Bing parent Microsoft (Nasdaq: MSFT) was an early investor in the company, Facebook has grown to the point where it's leaving money on the table if it doesn't roll out its own platform. There were 955 million active users on the site as of the end of June, and it's a pretty captive audience.

Google's search model has thrived over the years by shooing users away: Folks hit up Google's search box because they want to go elsewhere. Big G doesn't mind. There's money to be made with every sponsored lead it generates.

Facebook is turning that perception around. Stay. Search for what you want. Facebook can make money by mining your connections to deliver even better leads.

Facebook can do this. It closed out its latest quarter with $10.2 billion in cash, and any company willing to throw nearly $1 billion at a profitless Instagram is surely not beyond spending even more on a potential paid-search goldmine.

The social-media king is also big enough to pull it off. Revenue soared 32% to nearly $1.2 billion in the company's latest quarter. That may not seem like much, but Facebook has now surpassed Yahoo! (Nasdaq: YHOO), which generated less than $1.1 billion in revenue excluding traffic acquisition costs during the same three months. Microsoft's entire online services division generated $735 million during the same quarter, and it did so with yet another operating loss.

Google may have to squint to see Facebook in the rearview mirror, but the company has nonetheless become its closest online competitor. The search giant invaded Facebook's turf with Google+, and now it's Facebook's turn to return the favor.

If you don't think any of this will matter, you're not paying attention. Facebook is trying to revolutionize search in a way that no one else can.

A world of opportunity
There's a new premium report on Facebook detailing the opportunities and challenges in store for its shareholders. The report includes a full year of updates, so time's ticking. Check it out now.