Searching for the topic/post by ID?

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:

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.