SAN FRANCISCO  After failing to make any headway as a search engine, Ask.com is largely abandoning the effort and will now become a question-and-answer service.

The retreat is a major blow for Barry Diller, the chief executive of the e-commerce company IAC/InterActiveCorp, which had paid $1.85 billion in 2005 for Ask.com and then invested heavily to make the search engine more competitive against Google.

But the infusion of cash did not increase Ask.com’s market share. By changing direction, the Web site will avoid competing against companies with far greater resources while also reducing the cost of maintaining a search index with billions of pages, Doug Leeds, Ask.com’s president, said in an interview on Tuesday.

“This is the best use of our scarce resources,” he said. “There is a big untapped business here.”

As part of the shift, Ask.com will lay off 130 workers and close its offices in Edison, N.J., and Hangzhou, China. The remaining employees will be consolidated at the Web site’s headquarters in Oakland, Calif. Mr. Leeds said that Ask.com would continue to offer search on its site, but it would no longer compile an index of the entire Web. Instead, his company will license an index from another company, which he declined to name.