Beast had a birthday last week. The First Dog of social networking — live-in companion to Mark Zuckerberg and his bride, Priscilla Chan — turned two. The proud owners baked a cake for the Hungarian sheepdog and decided to throw an impromptu party. Naturally, when it came time to compile the guest list, the couple turned to Facebook, the $67 billion company that Zuckerberg founded in his dorm room nine years ago.

To date, sorting through your Facebook friends could be a frustrating task. Although the site has a search bar, there has been no easy way to quickly cull contacts based on specific criteria. But Zuckerberg was testing a major new feature that Facebook would announce on Jan. 15 — one that promises to transform its user experience, threaten its competitors, and torment privacy activists. It’s called Graph Search, and it will eventually allow a billion people to dive into the vast trove of stored information about them and their network of friends. In Zuckerberg’s case, it allowed him to type “Friends of Priscilla and me who live around Palo Alto” and promptly receive a list of potential celebrants. “We invited five people over who were obvious dog lovers,” he says.

For years now, Facebook watchers have wondered when the company would unleash the potential of its underpowered search bar. (Nobody has feared this day more than Google, which suddenly faces a competitor able to index tons of data that Google’s own search engine can’t access.) They have also wondered how a Facebook search product might work. Now we know. Graph Search is fundamentally different from web search. Instead of a Google-like effort to help users find answers from a stitched-together corpus of all the world’s information, Facebook is helping them tap its vast, monolithic database to make better use of their “social graph,” the term Zuckerberg uses to describe the network of one’s relationships with friends, acquaintances, favorite celebrities, and preferred brands.

In the weeks leading up to the launch, Facebook executives were still trying to come up with a name for the new product. They were hoping to stay away from the word “search,” to distinguish it from web search. (Only a few days before the launch, one Facebook executive slipped and referred to it as “browse.”) But after hours of contortionism, they relented; nothing topped Graph Search. “It’s descriptive — it’s search,” Zuckerberg says. “And the graph is a big thing.” The idea is that Facebook’s new offering will be able to extract meaning from the social graph in much the same way that Google’s original search unearthed the hidden treasures of the web. “People use search engines to answer questions,” Zuckerberg says. “But we can answer a set of questions that no one else can really answer. All those other services are indexing primarily public information, and stuff in Facebook isn’t out there in the world — it’s stuff that people share. There’s no real way to cut through the contents of what people are sharing, to fulfill big human needs about discovery, to find people you wouldn’t otherwise be connected with. And we thought we should do something about that. We’re the only service in the world that can do that.”

The result is surprisingly compelling. The mark of a transformative product is that it gets you to do more of something that you wouldn’t think to do on your own. Thanks to Graph Search, people will almost certainly use Facebook in entirely new ways: to seek out dates, recruit for job openings, find buddies to go out with on short notice, and look for new restaurants and other businesses. Most strikingly, it expands Facebook’s core mission — not just obsessively connecting users with people they already know, but becoming a vehicle of discovery.

Zuckerberg says that this is in fact a return to the company’s roots. “When I first made Facebook, we actually offered some functionality that was like this but only for your college,” he says. “Facebook then was arguably as much for meeting new people around you and exploring your community as it was for keeping in touch with the people you already knew. But it was such a hard problem to do it for more than a few thousand people at a time. We transitioned from connecting with whoever you wanted to primarily staying with people you already knew. But Graph Search is like the grown-up version of that discovery aspect. Exploring your community is a core human need, and this is the first big step we’re taking in that direction.”

The first of many steps, that is. Graph Search will be improved based on how people actually use it. So Facebook plans a slow introduction, limiting the initial rollout to a small number of users. Zuckerberg’s expectation is that by the time it becomes available to millions it will be considerably improved.

For example, he thinks he can make it easier to find invitees for a canine birthday party. “We don’t have the ‘who has dogs’ field yet,” Zuckerberg says.

Graph Search got its start in the spring of 2011, when Zuckerberg asked Lars Rasmussen to join him on a walk. Rasmussen, 44, had joined Facebook the previous year, an eyebrow-raising defector from Google. The Denmark-born engineer’s career had been distinguished by two projects, one a major win and the other a legendary fail. The first was Google Maps, which began as a small company based on a brainstorm by Rasmussen’s brother. Google bought the company in 2004 and expanded it into a landmark product so central to our digital existence that users almost rioted when Apple dropped it as the iPhone’s default mapping app. The second product was Wave, a complex system that mashed up conferencing, e-mail, and messaging. Rasmussen and his team got Google to devote $25 million and 60 engineers to the project, which he introduced in 2009 at a Google developers’ conference. His 80-minute product demo won a standing ovation. But Google pulled the plug in 2010 — Wave turned out to be too confusing to win over many users, marking what Rasmussen later called “the most painful and spectacular failure of my life.” A few months later, Rasmussen left Google and joined Facebook.

Now, walking with his young boss, Rasmussen was offered the chance to roll the dice once more. Facebook, Zuckerberg said, had a unique opportunity to deliver fantastic value with a different kind of search — detailed and targeted dives into its huge, structured database. Rasmussen was sold. “We could build a compelling new pillar,” he remembers thinking.

Rasmussen joined Facebook’s existing search team. The company already had truckloads of information, but it was hard for users to access. Who are my friends in New York City? What books are my friends reading? Is there anyone nearby who loves Wilco? What’s an Italian restaurant that people really like? The new search product would answer such queries. But Rasmussen’s team faced a tough quandary: whether to focus on the most popular kinds of questions — or take on the tougher challenge of building a smarter search engine that would let users ask Facebook pretty much anything.

That summer, Rasmussen, armed with a crude demo, met with Zuckerberg in a glass-walled area of Facebook’s then-headquarters called the Aquarium. The proto-search engine was limited to predetermined queries. But the engineer laid out a more expansive vision — the more ambitious approach that would allow the engine to process virtually any query. He talked of a search engine that could answer requests like “show me pictures of my friends and me visiting California in 2010.”

Zuckerberg now says that when he saw the demo, he thought that Rasmussen’s approach was dead right — but probably impossible. “No chance,” he says now, thinking back to his reaction. “You could type in anything you wanted and it would be the title of a new page with the content just magically laid out. No one’s gotten natural language to work like this. And then to actually be able to index all the stuff. There’s more than a trillion connections on Facebook! Building up the infrastructure to index all of it and be able to cut it in any way is a monumental technology challenge.”

Nonetheless, Zuckerberg enthusiastically expressed how sweet it would be if such an approach were actually implemented. In Silicon Valley–speak, that’s a direct order.

That summer, Rasmussen got a co-leader for his product: another former Googler named Tom Stocky, an MIT grad who had worked on various teams since joining Google in 2005. (This bears repeating: Facebook’s search product was led by two ex-Googlers.) His previous post there was as a director of product who worked on travel search — which made him a compelling target for Facebook’s search group. “They told me the vision — let’s make everything searchable and discoverable.”

For more than a year, Rasmussen and Stocky met Zuckerberg every Friday at noon to update him on their progress. Eventually 50 engineers would work on the project, including two linguists to help the engine understand people’s queries.

As the true scope of the search engine emerged, it became clear that Graph Search would require a full Facebook makeover. To encourage people to write more detailed queries, Facebook made the search bar bigger, essentially dominating a wide blue banner toward the top of the page; various icons were shoved to the margins. Most strikingly, the name of the company itself was dropped from the home page, replaced by a single stylized F. In other words, Graph Search was important enough to bump the word Facebook from Facebook. “When I first joined the team, I was a little skeptical: Is search really going to be the quintessential part of Facebook in the future?” says Keith Peiris, a product manager on the search team. “But we quickly realized that this was inevitable and would make Facebook stronger.”

The big adjustment was understanding that some of the rules of Graph Search were dramatically different from web search — and that part of the team’s task would be “diseducating” users. Good web search results can be had with very few, relatively vague keywords. But Graph Search works better the more specific and complex the request. To tease out those more complicated queries, Facebook makes guesses (or “type-aheads,” similar to Google’s auto-complete) as to what you might be looking for. Type in “New York” and it might ask if you want to find “friends from New York,” “restaurants people visit in New York,” or “things liked by people in New York.” The more complicated the query, the more precise the answer. Type “what restaurants in San Francisco are visited by my friends who like Homeland?” and you’ll probably get a valid result. “We really want people to unlearn the model of using the three vaguest words possible and instead actually say what they want,” says Peiris.

Now it’s time for Facebook to see for itself what users really want. Rasmussen says he has no idea what will happen, especially after experiencing both the ecstasy of Google Maps and the agony of the ill-fated Wave. “But I was nervous with the first product and not with the second,” he says. “So the fact that I’m nervous as hell is a good sign.”

In early December, Zuckerberg gave me an early look at Graph Search. He warned me that the product was still rough — at that point it didn’t even have a name. We met, along with Rasmussen and Stocky, in his conference room on Facebook’s new Menlo Park campus, formerly the home of Sun Microsystems. The ground-floor room was walled by glass; like its predecessor in the former Palo Alto headquarters, it’s dubbed the Aquarium. Zuckerberg, wearing his iconic hoodie, started the meeting seated; but as he spoke, his enthusiasm apparently compelled him to move around the room, occasionally bouncing a soccer ball for emphasis.

Rasmussen typed in “photos of my family,” and instantly a grid of pictures filled a display screen. “This to you will look like a bunch of silly blond people — I’m from Denmark,” he said. “But to me, this is just an awesome experience.” Then he asked for friends in New York, and it gave him the list.

“One of my favorite queries is recruiting,” Zuckerberg said. “Let’s say we’re trying to find engineers at Google who are friends of engineers at Facebook.” He typed in the query and found, not surprisingly, that there were lots of people who met those criteria. Each one was represented by a little rectangle of information — their profile photo, along with snippets of key information like where they went to school, where they live, and the names of the mutual friends. “It’s like Facebook is this big database and you’re doing a lookup on the results that match,” Stocky said.

“The good thing is that there’s people at the end of these connections,” Zuckerberg said. “You can find the right people or content page and then send a message.”

Rasmussen jumped back in. “And suppose I want a job at Pinterest — which I don’t, for the record — and I want someone to introduce me there,” he said. “I can search for my friends who are friends with Pinterest employees.”

None of this sounded like good news for Monster or LinkedIn.

Stocky then tried a dating query — “single women who live near me.” A group of young women appeared onscreen, with snippets of personal information and a way to friend or message them. “You can then add whatever you want, let’s say those who like a certain type of music,” Stocky said. The set of results were even age-appropriate for the person posing the query. “We’re trying to facilitate good things,” Stocky said.

The demo turned to recommendations. If you were to visit any given city, you could ask where your friends (or friends of friends) like to eat there. Or you could ask which restaurants are liked by people who express an interest in food — maybe those identifying themselves as food critics! — or who are graduates of the Culinary Institute of America. Or you could use Graph Search simply to noodle around for interesting information. One example: books liked by people who also like Mitt Romney. In other words, Facebook isn’t just helping people learn about their own friends and family, but about the broader world around them. That’s very much Google’s domain. And every request to find a hot restaurant, a cool museum, or the favorite tunes of art majors in Montreal may mean one fewer query for Google’s search engine.

When I got to play with the product myself a few weeks after that initial meeting — searching from my own Facebook account — I was struck most of all by what happens after the first results appear. In addition to the results themselves, which dominated the left side of the screen, the right side was filled with a dense column of further choices to refine or redirect my query. The Graph Search team calls this the Power Bar, and it is almost frightening in its ability to personalize potential questions. If you were looking for old college classmates whom you hadn’t yet connected with on Facebook, for instance, you could further look for people who graduated in your year or had the same major. Depending on your motivation, you might limit the search to those who are single or in an open relationship. Facebook already offers this kind of microtargeting to advertisers — for instance, a concert promoter can limit ad views to Iowa City residents under 30 who like bluegrass music. Now users will have that same power.

The results themselves were also tailored to the search. If Facebook thinks you’re doing a recruiting query, for instance, it will present a few facts about each candidate’s work history on the results page. If it senses you’re seeking a hookup, you’re more likely to see relationship status and location. Most significantly, each result has a little search button — which means you can conduct further searches on that specific person, business, or group, letting you parse whatever information that target has shared on Facebook and permitted you to see.

Graph Search also allows discovery of one’s own information. Some members of the Graph Search team often use the query “photos I like.” This yields a vivid collage of moments, likely populated by pictures of weddings, graduations, sunsets, nicely crafted profile photos, and raucous parties. “It’s a happiness-inducing experience,” says Stocky.

For some people, though, Graph Search might be a fear-inducing experience. Those who are already wary of Facebook for its privacy practices might chafe at the prospect of having their faces and personal information pop up whenever someone searches for “single women near me.” (In 2011 the Federal Trade Commission, charging the company with deceptive practices, reached a settlement that required regular privacy audits for the next 20 years.)

Sam Lessin, a director of product at Facebook, says the company is aware of the concerns and has already set in motion an antidote to unwelcome exposure by offering easier-to-use privacy settings. He emphasizes that Graph Search respects all the restrictions that people impose. “There actually isn’t any information being exposed in this that wasn’t already available on Facebook in certain ways,” he says. In that sense, he notes, Graph Search is similar to Newsfeed — a product whose introduction didn’t expose any new information or violate any restrictions, but made that information more prominent and persistent.

What’s more, he says, as much as Facebook’s leaders believe in their bones that sharing is a good thing, it’s also in their interest that people understand who sees their information — and that they stay in their comfort zone. “A world where you don’t understand who you’re sharing with is a world where you don’t share very much,” Lessin says. “So confusion is everyone’s enemy on this stuff.”

It will be interesting to see what happens once people do understand how the photos, interests, and personal details they share on Facebook are now part of a new product that may cause that data to be viewed more often and by people who otherwise might not have encountered it. Will this encourage people to share more so they can express themselves more widely and maybe even entice desirable new connections? Or will it lead them to share less and batten down their privacy settings so that new eyes won’t include them in a search-graph roundup? “The user base might bifurcate between the people who don’t want to be found and those who really do,” predicts Elliot Schrage, Facebook’s vice president of communications and public policy, who points out that Facebook will give users those choices. “It will be fascinating to see what the percentages are — and the demographics.”

Cognizant of the concern over Graph Search that may arise in some quarters, Facebook is trying to get ahead of any pushback. It plans to use the slow rollout as a way to alert users. “We are investing extremely heavily in the messaging of what this actually does,” Lessin says. “We can speak till we’re blue in the face about this in the abstract, but we’ll know how people will understand and react to it only when they see it and they interact with it.”

There will be plenty of time to find out. This launch version of Graph Search is only the beginning of a multiyear process of making search a key component of Facebook. “It’s really early,” Zuckerberg says. “There’s a huge amount of stuff that we obviously need to get to that isn’t in the first release.” The most glaring, he says, is that Graph Search is launching only in English. (Though he notes that 45 percent of Facebook’s users do understand that language.) And Graph Search currently doesn’t index perhaps the key content on Facebook: posts and status reports. It will be complicated and resource-intensive to incorporate them, but Facebook is already working on the task. Another big agenda item is assimilating the massive amounts of data generated by third-party applications. (For instance, imagine using Spotify to see who among your extended cohort has been obsessively listening to Laura Nyro. Or tapping into fitness apps to find a jogging partner who runs at the same track and same pace as you do.)

One more thing absent from the current iteration of Graph Search: ads. But they probably won’t be missing for long; search advertising, after all, is the web’s ultimate profit generator. Stocky says that Facebook’s search effort is currently focused on users but acknowledges that advertisers will likely follow. “Right now our user experience on Facebook is a little passive,” he says. “Graph Search is a way to ask a specific question, to express an intent in some way. And of course an advertiser would want to target that intent. That’s what search ads are for.”

Before long, Zuckerberg says, searching capabilities will be added to Facebook’s mobile apps too. Though he won’t share the product specs, you can bet that Graph Search on phones will include location, adding a powerful new dimension. (For instance, you might soon be able to figure out before entering a bar whether there are any attractive, unattached people your age inside with whom you share a mutual friend or favorite movie.) Zuckerberg is also open to the idea of adding voice queries (take note, Siri) and pushing the Graph Search team to develop a notifications system — maybe you could set up various criteria, and Facebook could alert you whenever anyone that met those conditions wandered into your vicinity.

Unlike his admittedly nervous project leader, Zuckerberg exudes confidence. When I ask whether he thinks the number of search queries on Facebook might one day match those on the major web search engines — like Google — he does not flinch. “Hopefully, over time,” he says. “But we’re building this because we think it’ll be something that people want to use. There’s a lot of things we haven’t built yet. But I think even in the beginning, the experience is going to be, ‘Wow, this is amazing.’”