Reuters/Stephen Lam Facebook is testing its own search engine, which will allow users to find and post links to articles without venturing anywhere near Google.

The new feature is part of Facebook's plan to keep internet users within its own ecosystem, stopping them from ending their mobile browsing session because of the awkward experience of finding, copying, and pasting a link from Google.

Some users of Apple's iOS mobile system in the US can now click on a new "add a link" button, which allows them to search for the link they want to share from within Facebook's app. The keyword search sorts results by the likelihood they have of being shared, prioritising newer or highly shared articles. Once users have picked articles they want from the results list, they can publish comments or status updates as normal. It is not clear whether Facebook's search engine is looking for links inside Facebook or externally on the web.

Facebook told TechCrunch it had indexed more than 1 trillion posts to find out which posts were being shared and who had shared them — data to which Google doesn't have access.

The entire scheme is part of a larger ploy to keep users on Facebook. The social network has already announced plans to host articles natively on the News Feed and split ad revenue favourably with publishers. If Facebook sells an ad, it will keep just 30% of its revenue, The Wall Street Journal reports. To woo publishers, the site is considering giving them 100% of revenue from ads they sell on Facebook-hosted news sites.

If it works, it will hurt Google. About 28% of all internet time is spent by users on Facebook. If Facebook search can end the need for people to look on the web for articles via Google, Facebook may steal even more of that attention.

As native advertising grows, Google's advertising business faces more challenges on mobile especially. The company lost mobile ad market share in 2014, according to eMarketer, down to 38.2% in 2014 from 46% in 2013. Facebook's ad share rose to 17.4% in 2014 from 16.4% in 2013. Google has had a boost in the first three months of 2015, as the lower rates charged for mobile advertising, which had previously worried investors, were outweighed by the number of ads sold.

By making it easy to find and recommend articles and other sites, Facebook is creating an ecosystem that — the company hopes — will give users less and less reason to leave.