Ask HN: Why does Google rank the real Python documentation below content farms?

259 points by josephcsible ↗ HN
Do a Google search for "python endswith". Obviously, https://docs.python.org/3/library/stdtypes.html#str.endswith is the correct best hit for that term. Why does Google rank that page below all of the well-known low-quality content farms like GeeksforGeeks, W3Schools, and Tutorialspoint?

150 comments

[ 1.6 ms ] story [ 248 ms ] thread
Because the page you've linked has 24,599 words in total, out of which only 43 words are dedicated to "str.endswith". You can make a beefy SEO article specifically on this method by talking about it a bit, and then providing a lot of examples in various different scenarios.

The bottom line being that there is nothing you can do about it unless Python themselves fundamentally change how the documentation is structured, which I doubt they have plans to do.

Honestly, changing the way they do it is a fine idea. Massive documentation pages were how we did it in the olden days. And I think they're still good for when you want to read through and get an understanding of the whole library. But having that also broken up into a lot of small pages that link back to the main doc would be really helpful to people who are searching for specific solutions.

I think that could mostly be done in an automated fashion to start. Then into the master doc you can start adding hinting and extra material that gets rendered into the sub-pages. So it could be approached gradually.

You're not wrong, but I think now the majority don't want an understanding, they just want answers.
I really hope they don't enshittify their documentation just to rank in Google.
I disagree - Google can and should modify their algorithms until the site that users actually want is first. Tracking which sites users click on for those searches, or maybe which sites users with those searches click on last should give a pretty strong signal that python.org should be ranked far above the spam farms no matter what the content percentage difference is. Content percentage is a clearly gameable metric that shouldn't outweigh other factors.

I'm honestly surprised Google employees haven't fixed this somehow, surely they have thousands of people running into this problem daily.

> Google can and should modify their algorithms until the site that users actually want is first.

Why?

Google is an ad company, that has integrated search.

Why would they cut their own bottom line in order to make data happy?

You aren’t their customer. You are Google’s data. Google’s customers buy your data.

Why would they change anything about their business model, which works amazingly well?

Because not paying attention to the quality of the product means google is A-okay with the normal brand arc and is on the part where the brand cuts quality to boost profits while coasting on name recognition- I.e the enshittification phase.

They can coast for an indeterminate amount of time, but with the risk that eventually the consumer will be fed up and stop using them, especially if a decent alternative pops up.

Decent alternatives have been bandied about here for over a decade. Guess what? There are none.

Google’s business model is selling user data to the highest bidder. Google’s other business model is selling opportunity to collect data on people.

You as a search user are not a customer, but a data point.

There is literally no incentive for this to change.

Desiring an ad company to not show ads is a ridiculous desire.

That’s not quite right - users are customers paying for a service, search, in exchange for a payment, I.e. their time and eyeballs.

At the same time google coordinates with their other customer and swaps the time and eyeballs for money.

But users are definitely a customer paying with time in return for search results.

If the product becomes too obnoxious, people don’t even need an alternative to quit. It’s happened with other products. Not everyone will quit, but the customer base will shrink.

Google owns chrome, and chromium.

Google’s data gathering isn’t just search.

Anyone not using Firefox, and even those who are using Firefox, is gifting Google data.

That data is worth more than search results or search data.

Google knows where you browse. Google knows how many clicks, scrolls, and keys pressed. Google knows what your email contents and preferences.

Search is a tiny portion of Google’s data collection behemoth and whether users quit Google search for bingo search doesn’t matter much to them.

Their business model depends on users finding their search results useful. I think Google’s business is far more fragile than it looks. That’s why they’re doing all the things that are now in the crosshairs of regulators.
Google has never worked this way. By adding more examples to an SEO article you are also actively farming long-tail clicks, which will make people spend more time on the page and if Google was to use that as a metric (there have been rumours) then it is beneficial to the SEO site as well.

Like I said, Python or any other language can fix this issue by changing the entire mindset of how documentation is built. You can then get the OSS community involved on GitHub to slam dunk on all the SEO spammers.

Just look at MDN or Web.dev, both have their content repos up on GitHub and people contribute metric tons of useful info. And both of these sites have healthy standings in the context of SEO.

No, MDN routinely loses to w3schools and geeksforgeeks too.
I do agree with you but I didn’t feel it was necessary to point that out. MDN doesn’t use SEO titles so my guess is, that is where it loses out a bit, but for most in-depth JS/CSS stuff, I generally get MDN as a top result.

Can’t remember the last time I visited W3S/GFG to be honest.

It’s about to get worse though as it appears that DigitalOcean is putting a nail in the coffin for CSS-Tricks and Google will absolutely demote it because of inactivity, only the most linked-to pages will survive until DO decides to shit the bed and try and move the entire site to their Tutorials platform.

> Like I said, Python or any other language can fix this issue by changing the entire mindset of how documentation is built.

Please, please, I beg of you, in the name of all that is holy, do not push for SEO bloat in documentation!

I mean at one point Google never returned image results.

Certainly some of the Python queries could return a card promoting a result from python.org just like other queries return a card promoting wikipedia.org

It seems that you believe Google is not taking those signals in consideration in their algorithm.

Google search rank has been an ML driven algorithm for ages now and take into account dozens of signals. User rejection (how fast people come back to the search from a result click) and obviously which results get clicked more often are examples of that.

I do believe that they do this, but that their weighting is off, sorry for not being clear. I was mostly responding to the parent comment talking about ratios.

Based on other comments saying they like the sites I consider spammy, maybe the weights aren't even wrong, they're just not optimized for me!

> Google can and should modify their algorithms until the site that users actually want is first.

Who, exactly? A professional Python programmer probably has their IDE/editor set up so it can shows a brief document for `str.endswith` already. Someone who is new to Python (probably not even a programmer yet) might actually prefer the hand-holding from those content farm pages.

[1]: https://news.ycombinator.com/item?id=37483100

> A professional Python programmer probably has their IDE/editor set up so it can shows a brief document for `str.endswith` already. Someone who is new to Python (probably not even a programmer yet) might actually prefer the hand-holding from those content farm pages.

Someone who has been exposed to the most basic Python features and knows they want info on str.endswith can just type help(str.endswith) in the Python interactive environment.

So, maybe google should tell them that and turn away their business?
I’m saying that fact shapes the set of people resorting to Google in the first place and what they are looking for.
Which is all very well (and for something simple like str.endswith might well be enough), but for many things, even a professional Python programmer might either a) not remember the exact name of the method or other thing they're looking up, or b) want a more detailed explanation or examples showing usage.

None of that is going to be given either in an IDE or from help().

There is much more to documentation than just API documentation. A documentation window in a text editor isn't shareable either.

Also, who'd actually want hand-holding from low quality content?

As a professional Python programmer, I regularly search for the official documentation on things like the details of MagicMock or other things, for both Django and Python. I'm generally looking up things that are more than "what does str.endswith do", and more like "what's the name of the field of the mock that shows what it was called with", or other things that I know exist but don't use day-to-day.
> Google can and should modify their algorithms until the site that users actually want is first.

That is what Google is doing! But remember, the advertiser is the user, not the person running the search.

If you want to be the user, and get good search, pay for kagi.

How do you know their users don’t actually want these other sites and would rather read the formal docs?
I've been doing a little python lately. the top hits are 80% ads, and if they even have what you want its buried after 2-3 pages of nonsensical crap. this isn't a real choice
but will this strategy give them more advertising impressions or clicks? if not, then why bother? Google dropped it's desire to be user-friendly quite a while ago, when it became clear that it didn't matter if they were serving anyone but it's advertisers
Somehow kagi.com manages to rank the top results better than Google:

- a stackoverflow answer that has a useful example: https://stackoverflow.com/a/18351977/

- the Python documentation: https://docs.python.org/3/library/stdtypes.html

- Pandas documentation (they also have an endswith): https://pandas.pydata.org/docs/reference/api/pandas.Series.s...

- a blog post on Python regular expressions (this looks useful but is a wrong result for this query): https://www.johndcook.com/blog/python_regex/

- something that could be a content farm with rephrased Python documentation: https://pythontic.com/concepts/string/introduction

The top three results are good, and I guess it's a matter of taste whether the succinct Stackoverflow answer is better than the verbose official documentation.

You can also raise/lower domains in kagi. So if you're a python developer, you can boost docs.python.org to personalize your results.
"somehow" is due to their different income model from google. their customers are their search users, not advertisers, so it's not surprising they serve the people that pay them. I'm a very, very happy Kagi user due to this!
Aren't you describing the exact problem that Page Rank was supposed to fix?

We've come full circle.

> unless Python themselves fundamentally change how the documentation is structured, which I doubt they have plans to do.

Nor should they, in my opinion. Quality of documentation is more important than that.

>The bottom line being that there is nothing you can do

Google's ENTIRE JOB is to surface the CORRECT content for a query. If they are objectively not doing that, then they are in the wrong. Imagine credit card fraud just kept increasing, and instead of adapting and improving their systems, companies just threw up their hands and said "deal with it, not our problem, nothing we can do" as you had to generate a new credit card number every other day because even the most trivial card number enumeration attacks were not stopped.

The fact that google is completely unwilling to change how they operate to prevent even the simplest, intern driven SEO trash from overtaking literally authoritative sources should be exhibit A in a trial to break up Google, as evidence of how negative value they are to the consumer.

It's the rough equivalent of Fedex just throwing away a third of the packages they are supposed to deliver at random, and people seemingly just saying "eh, nothing can be done"

> Google's ENTIRE JOB is to surface the CORRECT content for a query

Google's job is to serve ads profitably. It's something like 90% of their profit (80% of revenue). To some extent they even have an incentive to show poorer results first because it makes you stay on the page longer and look at more sites (more ad impressions).

in to boost this thinking. "correct" is only relevant for profitability of the advertising stream
Kagi has a simple fix for this. It’s not a hard problem to solve, they just have no incentive to solve it.
Kagi's solution to pin, bump or blacklist some websites is awesome. It's a shame Google doesn't have something as simple and elegant after all these years.
Google can't make money serving ads if you go to the ad-free python.org.

Obviously I'm not saying they're singling out python or documentation in general as some kind of cash cow. More realistically the story is that, sites that serve ads make money, and can spend money on cat-and-mousing SEO to keep making more money. Technical docs aren't going to do that. Google could whitelist them but it seems they turn a blind eye for the aforementioned reason.

(comment deleted)
Google shouldn’t whitelist them but use them as a test case for the ranking algorithm. If a content farm comes up ahead of the official documentation site then the algorithm is obviously broken.
Google search is now practically shit. Instead of adapting it's rank so it links to high-quality content, it forces sites to adapt to its ranking model so they have to produce meaningless crap.
I don't think word count is a new metric. It's just that documentation wasn't much of an ad revenue market in the past. Link juice also flows for backlinks. These sites definitely get heavily linked by blog spam.
While I believe this is still a bad metric, I also believe that finally it should be up to the user to decide which sites they want ranked first - I'd definitely boost python.org while banning these content farms.
Some day I'm going to start paying these people:

https://kagi.com

DuckDuckGo is a bit better than Google at avoiding content farms and semantic web spam, but I think it's mostly for the same reason Linux and MacOS used to have zero malware.

I hate shilling for the Russians but I've been very impressed with Yandex lately.

It retains that early-2000s Google vibe, where there were still quirky independent sites to discover. Using it also surfaces just how much Google is censoring its own results on controversial topics.

Yandex is great, same as its image search. Props to the Russians heh.
https://kagi.com/search?q=python+endswith checks out:

1: docs.python.org › 3 › library › stdtypes.html

2: pandas.pydata.org › pandas-docs › stable › reference › api

3: This discussion!

I've tried DDG and Brave for a few weeks each, and gone back to them once in a while when Google search has completely failed for things I know exist. They mostly have worse results than Google (purely in terms of relevance of the first page), and Google is trash now. I'll give Kagi a try for a few more days and see, but maybe the web has finally got to the point where paying for search is a useful strategy.

Brave Search is enabling you to do that with Goggles: https://search.brave.com/help/goggles
I have used Brave search for some days.

It's extremely bad.

You can see for yourself.

I use Brave Search pretty regularly. I'm not going to say it's better than Google, but in my experience, it's a not-too-distant second.
For me, second, and in many cases, better is- DDG.

As I mentioned in another comment, Phind and You Code have been quite good as well.

the worst thing about those sites is they are slow.

I get why at least with the python docs, they're a little dense. some of those others have example uses which I could imagine people find useful.

geeksforgeeks with the login nag page is pretty bad.

It’s a general problem. In the past I have seen great HN threads sharing exclude lists etc to avoid the scrapers. Google could, of course, track a few thousand canonical sources so that just python and SO and a few others don’t get beaten to the top in their specific expert areas, but it doesn’t genrtalize. Google has no real algorithmic idea who is copying who.

And then it hits me: the proper documentation for things are on pages without ads! Perhaps that’s the signal google needs to start weighing heaviest…? ;)

SO isn't a canonical source, they're another content farm using nofollow links to the content they appropriate to maintain their search edge.

Its entire purpose is to inject itself as a search middleman. Even worse, I find myself landing there from google results to a question they had closed as not worthy of the site, but worthy enough still to keep up for the search juice.

> I find myself landing there from google results to a question they had closed as not worthy of the site

Well, you did google for the question and not for the answer. ;)

True, and it was even more accurate a few years ago. Now Google moved towards understanding queries and giving context-specific answers rather than a strictly keyword based engine. You were considered a bad googler if you asked it a question, now it's the norm.
> Google has no real algorithmic idea who is copying who.

This is an irrelevant distraction, because Google's literal army of nearly 200,000 full time employees, a large number of whom are Python developers, do know. Geeksforgeeks, w3schools, programiz, tutorialspoint, and python-reference.readthedocs, which all rank higher than the official documentation, are not flash-in-the-pan sites. They've been polluting the search results for literally years. Trivial manual processes at Google scale would be 1000% fine and effective.

Google could, if it gave half a shit, give every employee a Chrome browser extension that lets them manually vote on the reasonability of site rankings within known problem genres for their own searches.

I have the feeling that this very page would be downranked very fast if such an extension existed.
Honest question: haven't people developed something akin to mental-ad-masks when it comes to Programiz, G4G, TP, etc.?

Like I never ever ever click on a web ad, and can't even remember the brand it was about 3 seconds after leaving the page, whenever I see G4G, TP, etc., I never ever ever click them. At this point, I think this doesn't even reach my brain, but is handled by my spinal chord.

It does reach your brain, and it does affect you, just like a fog of gnats you've grown accustomed to still affects you.

For what it's worth, the ads aren't for you. They're for anybody or anything that might click them, knowingly or not, and that's not you.

Isn't boosting websites without ads against their interest?
This is what I was hoping all the replies would be about :)

Is monetising the web through advertising the reason these scraper sites exist? And removing that would make scraping sites an expense with costs rather than profits?

Perhaps google could do this. Ads on third party sites are probably a small part of their income compared to sponsored ads in search results, so they could be sacrificed and they’d take down their competitors who rely more on the website ads because they don’t have the search?

However, they have no need to compete on search quality at this time. If another player in the search and browser wars started downweighimg ad heavy sites then this might make google have to reluctantly follow suit. But you can imagine the FUD campaigns to paint such an actor as killing the internet and being the bad guy etc…

I wanted to start a new search engine that would index content from ad-free websites only.

Then I realised StackOverflow has ads nowadays and my search offering would be useless for like 98% of devs.

Agreed that Google is not very helpful here, but searching the Python docs directly works pretty well:

https://docs.python.org/3/search.html?q=endswith

Otherwise I really like ChatGPT like this: you put in minimal work into the query and it usually fills in useful info. If you use "Advanced Data Analysis" mode it will run those examples in the browser.

AI content farms are about to kill Google anyway
I don’t see any ads on any of those mentioned pages…
Kagi returns the expected link first, for what it’s worth.
(comment deleted)
Not an answer to OP question, but if you find yourself googling "python endswith" (as per example) then your DX is somehow broken.

Invest in good code editor with linting. No more googling for such trivial things

(comment deleted)
DX: "Developer Experience"

I suspect that someone who needs to know that their developer experience is broken probably doesn't know what "DX" means.

This shit is so frustrating, every query I ever have for Rails stuff goes to APIdock
(comment deleted)
Because Google is run by business executives and clueless product managers. The engineers have been forced into the back to only think on whatever the current sprint is and told to buzz off when it comes to biznass decisions only those with MBAd can solve.
probably to do with realpython blocking content with the popup unless you sign in.
I've completely stopped using Google for this kind of thing. ChatGPT or devdocs.io to go straight to the docs
We are to a point where I think Google should start manually de-ranking content mills and blogspam, or even stop indexing them altogether.
Short answer: The rea Python documentation is paying less money to Google than the content farm.

Long answer: Balancing the many interests of search result parties, the decrease of consumer satisfaction is by Googles benchmarks outweigh by money received from their paying customers.

Use Bing, results are relevant and they do not yet rank paying farms as number one.

Because adding exceptions to an algorithm doesn't scale, they won't add any. Because customer service doesn't scale, they don't have any. And so on. Frustrating isn't it? It's what happens when you let engineers design a product. Letting system behaviour at the limits dictate everything.
They've added plenty of exceptions in the name of "cards". Wikipedia, movies, celebrities, ...
Hey at least the first result isn't some StackOverflow overlord schooling you on why you should never use endswith, right? /ₛ
Checkout devdocs.io. I'd suggest using this if you want to search official docs. But first you need to enable whatever language you want to search. I enabled python 3.11 and searched `endswith` and immediately found the documentation.

I know this doesn't answer your question, but I hope this helps you in the interim.

Google search heavily focuses on the last page that users visit for a query. And python documentation is hard for most novice programmers to understand.

My guess would be that engineers first go to documentation, don't understand it, go to low-quality-content-farms which answer their questions in natural language. It's low quality but it's enough for novice use cases such as python endsWith.

And this leads to a big reduction in Google's ranking of python docs.

TLDR : most novice programmers don't/can't read docs.

I think your TLDR is accurate, but I think the mechanism is likely even simpler than Google looking at the last page visit.

The docs are written by and for experienced programmers. They're very dense with information but light on examples and comments that explain things for dummies.

Its popularity means the vast majority of Python users are novices who would find the docs hard to read. Geeksforgeeks et al are providing content for them and so is actually a better resource to show the majority of searchers (especially given that it's a basic string formatting question, something very likely to be searched by for novices).

Have you ever seen Google ads on the Python documentation?

But more seriously... I think it's because the language and framing of the python documentation is difficult for a new user to understand.

Yes, Python is miles better than some other languages at documentation, but it's still more of a reference than a tutorial. I remember when I first started learning Python, I read blog entries (e.g. blogspam) more than I did the official docs.

In my intermediate phase, I searched Python docs but I didn't need Google's help for that.