Searching for the topic/post by ID?

AI-generated summary

The discussion revolves around the feature request to search for topics or posts by their ID in Discourse. ronteras initiates the conversation by asking if Discourse can allow users to search for topics or posts by their ID, similar to how pasting an ID in the search bar shows the corresponding topic. sam mentions that this feature was previously available but removed due to confusion. ronteras expresses interest in making IDs more practical, suggesting a dedicated field for ID search. mcwumbly and PJH discuss the current functionality of URLs and IDs, noting that IDs can be used in URLs to directly access topics or posts. mcwumbly suggests that search could interpret plain numbers as topic IDs. zogstrip clarifies the URL structure and the importance of the topic ID parameter. ronteras explains the use case, highlighting the preference of users with technical backgrounds or Reddit experience to share topics using IDs for cultural identification and simplicity. anon21958287 and boomzilla share similar experiences from other platforms like Jira. codinghorror suggests using a prefix like t: in the search bar for advanced users. cpradio and elberet discuss the current search behavior with numbers. mcwumbly supports the idea of advanced search operators. ronteras proposes making IDs more visible and search-friendly. codinghorror points out that IDs are already visible in the share box and URL. ronteras reiterates the need for a search-friendly keyword like t:2075. wesochuck and huynhthai824 express interest in implementing this feature. marcozambi questions why the t: convention was not introduced. Bathinda and fbpbdmin discuss searching for URLs and topics created by specific IDs. Moin suggests searching within a topic using its ID. Jagster and Bathinda discuss the challenges of accessing URLs in PWAs. The conversation highlights the need for a more straightforward method to search and access topics by their IDs, with suggestions ranging from dedicated search fields to advanced search operators.

Title says it all. Can Discourse have the feature that allows users to search for the topic or post by its ID? Just like pasting 19084 in the search will show this topic?

1 Like

We had this in the past and removed it caused confusion

Ah ok, didn’t notice that. I’d love to see IDs getting more practical features. What about having a little field/textbox somewhere near the search that goes like:

1 Like

Where was it?

I could see this being useful in some cases.

Perhaps search could search by id if only a plain number is used?

I could also see it be useful to have an auto linker in posts when text meets a certain pattern like #123 (ignoring the obvious hash tag conflict for the moment)

May be better to think of doing this kind of thing via a plugin or opt-in site setting though.

@ronteras can you tell us a little more about your particular use case?

Searching for the topic/post by ID? if copy/pasted literally will, if I understand you correctly, do exactly what you’re after. The topic title doesn’t have to be correct in the URL.

From one of our FAQs:


/t/<topic_name>{/<topic_id>{/<post_id>}}}

  • Bog-standard link to a post. topic_name is largely ignored if topic_id is present and valid.
  • Omitting the post_id will send you to the first post of the topic.
  • Visiting post_id 1 will (by default) result in the URL in the address bar being re-written to remove it (i.e. it collapses to the above.)
  • Visitng post_id of a large number not present will send you to the end of the topic
  • Omitting topic_id will send you to the topic if topic_name is valid, 404 otherwise
1 Like

BTW this actually just works too. Clicks the search icon and type a number!

Oops nevermind, that’s a lie. It works on this topic now because the topic id in the text body…

1 Like

The topic_id parameter is actually required in that it is the default URL (you will be redirected if you provide a valid slug).

Also, it isn’t exactly post_id but post_number instead.

You no longer need to provide a slug. There is a route now that resolves URLs like:

/t/<topic_id>

2 Likes

Which makes the topic_id parameter even more important :wink:

This is not a deal breaker, it’s just sending/sharing only topic ID without copying/pasting long urls and etc. People can just paste the ID in the field that I have attached and go to the topic/post. Look at this as just another method to access the topic but in a bit geekier way. Besides, /t/19084 pattern could be a unique cultural identifier of Discourse in certain communities.

I know, I want just an easier way of this :D. typing topic/post ID vs typing yourdomain.com/t/ID

1 Like

I get it, but can you describe why you or your users would prefer finding topics by id in particular?

Is it because you refer to them by id in other conversations or systems you use or something?

[Our community][1] is general purpose forum talking almost about anything and expanding moderately fast. The majority of users come from either technical background, or are reddit users or both. I’ve noticed that the preferred way they share links on various social networking sites is this belongs to /t/topic-name instead of simple link to the topic and I’m getting why they are doing this, just to mention/hint their insider or familiar position on our forums.

The other reason is that there are bunch of users who prefer not to use full links that include
topic names for some specific reasons and instead have numerical ID’s while sharing topics and posts.

Third reason is that it just looks cool this way :D.
[1]: http://www.front.ge

I’ve seen at least one. :smile:

I’m used to doing this in, e.g., Jira. We often just pass along a number in conversation or in an IM or email or whatever. Sometimes I’ve edited the URL (as mentioned up thread) but they also have a “quick search” box where you can enter the ticket number and go right to it. Very useful.

3 Likes

I am curious why “useful in some cases” necessitates overrides when the sort of advanced user that would want to enter a topic by ID, could simply edit…

/t/2075

… into the address bar?

I also worry about arbitrarily overriding numbers, if you type 1984 in the search, you might be searching for

Seems like a candidate for advanced search at best, maybe if you type t:2075 in the search bar, it would take you there?

6 Likes

yes please, that sounds good enough.

2 Likes

I don’t understand why that’s needed? I press / and type 2075, press enter and it takes me to that topic…

But that only works because the number is mentioned as a word in the post text. :slight_smile: Searching for other arbitrary numbers leads you to very different topics or yields no result at all.

Works for this one too…

Weird.. Definitely doesn’t work for all though.

Yeah, it for some reason works for 19084 and a few IDs down. 19082 might be a PM…? 1908 yields strange and unrelated results, tho…

But 19149 doesn’t work and that is the PGP Encryption thread… so this is a bit odd on when it chooses to work and when it doesn’t.