Search issue or PR by its id / index number #1851

Closed
opened 2025-11-02 04:15:07 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @HerrHase on GitHub (Jun 4, 2018).

  • Gitea version (or commit ref): 1.3.2
  • Git version:
  • Operating system: Ubuntu
  • Database (use [x]):
    • PostgreSQL
    • [*] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [*] Not relevant
  • Log gist:

Description

I have often the Problem that i want to search by the ID. Is there a way to add a search like this, "#"?

Originally created by @HerrHase on GitHub (Jun 4, 2018). - Gitea version (or commit ref): 1.3.2 - Git version: - Operating system: Ubuntu - Database (use `[x]`): - [ ] PostgreSQL - [*] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [*] Not relevant - Log gist: ## Description I have often the Problem that i want to search by the ID. Is there a way to add a search like this, "#<id>"?
GiteaMirror added the type/proposaltype/enhancement labels 2025-11-02 04:15:07 -06:00
Author
Owner

@Aviortheking commented on GitHub (Jun 5, 2019):

+1 & maybe make it work too for this part
image

@Aviortheking commented on GitHub (Jun 5, 2019): +1 & maybe make it work too for this part ![image](https://user-images.githubusercontent.com/15822031/58942103-6532ca80-877d-11e9-9e71-49437c1b90f9.png)
Author
Owner

@alexanderadam commented on GitHub (Jul 3, 2019):

@Charliekenney23, I'm just curious: do you have any open PR regarding this issue?

@alexanderadam commented on GitHub (Jul 3, 2019): @Charliekenney23, I'm just curious: [do you have any open PR regarding this issue](https://github.com/go-gitea/gitea/issues/5462#issuecomment-445098047)?
Author
Owner

@0xch4z commented on GitHub (Jul 3, 2019):

@alexanderadam Ah sorry, totally forgot about this. I got really busy after saying I'd take this. Anyone else is welcome to pick it up.

@0xch4z commented on GitHub (Jul 3, 2019): @alexanderadam Ah sorry, totally forgot about this. I got really busy after saying I'd take this. Anyone else is welcome to pick it up.
Author
Owner

@tyroneyeh commented on GitHub (May 28, 2022):

Hello

Could try the script to search issue #ID or PR #ID

image

Below code please paste to custom/templates/custom/footer.tmpl

<script>
!function(){var e,t;if("/milestones"!=location.pathname&&(e=document.querySelector(".search"))&&(t=e.querySelector("button"))){var n,o,i,r=document.querySelector("input[name=q]"),c=document.querySelector(".form");t.type="button",c.addEventListener("submit",(function(e){""!=c.q.value&&e.preventDefault()})),r.addEventListener("keydown",(function(e){var t=r.value.trim(),n=t.match(/([\w/]+)#(\d+)/);if(13==e.keyCode&&t){if(""==t.replace(/[#0-9]/g,"")&&!i.disabled||-1!=t.indexOf("#"))return i.click();c.submit()}else n&&(i.disabled=!1)})),t.addEventListener("click",(function(){c.submit()})),((n=document.querySelector(".filter .blue.button.repo"))||document.querySelector(".page-content.repository"))&&(o=location.pathname,n&&(o=n.title+location.pathname),i=t.cloneNode(),n&&!n.title&&(i.disabled=!0),i.type="button",i.textContent="#",i.title="#ID search",i.style.padding="10px",i.addEventListener("click",(function(){var e,t=r.value.trim(),n=t.match(/([\w/]+)#(\d+)/);return""==t.replace(/[#0-9]/g,"")?location=o+(t?"/"+t.replace("#",""):""):n&&n.length&&(e=document.querySelector("[title*='"+n[1]+"']",document.querySelector(".filter")))?location=e.title+location.pathname+(n[2]?"/"+n[2]:""):void c.submit()})),e.appendChild(i))}}();
</script>
@tyroneyeh commented on GitHub (May 28, 2022): Hello Could try the script to search issue #ID or PR #ID ![image](https://user-images.githubusercontent.com/1255041/170813586-dbd1fbff-beac-4dce-ab72-74235fe34fa1.png) Below code please paste to custom/templates/custom/footer.tmpl ```js <script> !function(){var e,t;if("/milestones"!=location.pathname&&(e=document.querySelector(".search"))&&(t=e.querySelector("button"))){var n,o,i,r=document.querySelector("input[name=q]"),c=document.querySelector(".form");t.type="button",c.addEventListener("submit",(function(e){""!=c.q.value&&e.preventDefault()})),r.addEventListener("keydown",(function(e){var t=r.value.trim(),n=t.match(/([\w/]+)#(\d+)/);if(13==e.keyCode&&t){if(""==t.replace(/[#0-9]/g,"")&&!i.disabled||-1!=t.indexOf("#"))return i.click();c.submit()}else n&&(i.disabled=!1)})),t.addEventListener("click",(function(){c.submit()})),((n=document.querySelector(".filter .blue.button.repo"))||document.querySelector(".page-content.repository"))&&(o=location.pathname,n&&(o=n.title+location.pathname),i=t.cloneNode(),n&&!n.title&&(i.disabled=!0),i.type="button",i.textContent="#",i.title="#ID search",i.style.padding="10px",i.addEventListener("click",(function(){var e,t=r.value.trim(),n=t.match(/([\w/]+)#(\d+)/);return""==t.replace(/[#0-9]/g,"")?location=o+(t?"/"+t.replace("#",""):""):n&&n.length&&(e=document.querySelector("[title*='"+n[1]+"']",document.querySelector(".filter")))?location=e.title+location.pathname+(n[2]?"/"+n[2]:""):void c.submit()})),e.appendChild(i))}}(); </script> ```
Author
Owner
@tyroneyeh commented on GitHub (May 30, 2022): Demo Videos: https://user-images.githubusercontent.com/1255041/170910170-c3f199ab-715b-4376-beb8-af69cbb35b40.mp4
Author
Owner

@lunny commented on GitHub (May 31, 2022):

Demo Videos:

hashtagsearch-2022-05-30_11.07.46.mp4

Looks interesting.

@lunny commented on GitHub (May 31, 2022): > Demo Videos: > > hashtagsearch-2022-05-30_11.07.46.mp4 Looks interesting.
Author
Owner

@nicorac commented on GitHub (Aug 24, 2022):

Could try the script to search issue #ID or PR #ID

That's great, and it works perfectly... till the function will be implemented in Gitea 😉
Thank you very much!

@nicorac commented on GitHub (Aug 24, 2022): > Could try the script to search issue #ID or PR #ID That's great, and it works perfectly... till the function will be implemented in Gitea 😉 Thank you very much!
Author
Owner

@tyroneyeh commented on GitHub (Sep 23, 2022):

There are other options for this, but it's still a draft #19646

@tyroneyeh commented on GitHub (Sep 23, 2022): There are other options for this, but it's still a draft #19646
Author
Owner

@yp05327 commented on GitHub (Apr 28, 2023):

I think what we need in issue/pr list page is Go To #xxxx issue's page, not search issue by id, it will cause a lot of problems in search algorism.
When I want to access a issue which I know the issue id, I will open another issue and edit the issue id in the url, then press Enter. This is not friendly I think.

@tyroneyeh's idea looks good to me. Can you create a PR ?

@yp05327 commented on GitHub (Apr 28, 2023): I think what we need in issue/pr list page is `Go To #xxxx issue's page`, not `search issue by id`, it will cause a lot of problems in search algorism. When I want to access a issue which I know the issue id, I will open another issue and edit the issue id in the url, then press `Enter`. This is not friendly I think. @tyroneyeh's idea looks good to me. Can you create a PR ?
Author
Owner

@tyroneyeh commented on GitHub (May 2, 2023):

Hi @yp05327

Please check #24479

@tyroneyeh commented on GitHub (May 2, 2023): Hi @yp05327 Please check #24479
Author
Owner

@lunny commented on GitHub (May 3, 2023):

We should follow GH to have a domain search language like number:69 but not mix the keyword and the number.

@lunny commented on GitHub (May 3, 2023): We should follow GH to have a domain search language like `number:69` but not mix the keyword and the number.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1851