Skip to content

When searching execute, link to scroll to text fragment doesn't work due to incorrect fragment #1954

Open
@alexgmin

Description

@alexgmin

Due to this PR the docs search now has scroll to text.

When searching execute: https://docs.djangoproject.com/en/5.1/search/?q=execute

The second option, "Performing raw SQL queries", links to
https://docs.djangoproject.com/en/5.1/topics/db/sql/#:~:text=execute%28%22UPDATE%20bar%20SET%20foo%20%3D%201%20WHERE%20baz%20%3D%20%25s%20%22%2C%5Bself.%20baz%5D%29
Decoded: https://docs.djangoproject.com/en/5.1/topics/db/sql/#:~:text=execute("UPDATE bar SET foo = 1 WHERE baz = %s ",[self. baz])
However this doesn't scroll to the place.
The correct one should be this one
https://docs.djangoproject.com/en/5.1/topics/db/sql/#:~:text=execute(%22UPDATE%20bar%20SET%20foo%20%3D%201%20WHERE%20baz%20%3D%20%25s%22,%20[self.baz])
Decoded: https://docs.djangoproject.com/en/5.1/topics/db/sql/#:~:text=execute("UPDATE bar SET foo = 1 WHERE baz = %s", [self.baz])

There are two differences:

  • Extra space after: WHERE baz = %s
  • Extra space after the dot: [self. baz])

I haven't dug further on why is this happening, whether is a fragment issue only or is an indexing issue that just happens to show up on this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions