Unexpected Search Behavior: When 'commands' Doesn't Find '/commands'

In my documentation I have documented /commands formatted in backtick code formatting. However, if I search for “commands” there is no result. The search has to be /commands for the topic to show up.

Is this intentional behaviour? I don’t expect users to search for a specific command prepending the / - both should find the topic imo.

Edit; codeformatting is unrelated, as simply “/commands” ends up in the same issue.

Edit 2; can not reproduce this with for example “.command”, searching for “command” gives the desired result in this case.

2 Likes

Hopeful bump. :smile:

I don’t repro this when I search /commands:

We just failed to find commands, which we could debate it should find, but it’s not a bug per say.

I looked for “search” related settings, but couldn’t find anything obvious. Any clue what to look for?

No I think the behavior is expected

Right, I do not expect my users to know upfront that they need to include “/” to find this. Any reason why this behaviour is expected or a possible workaround? Because it seriously affects the search-ability of my documentation.

Search is a complicated matter :slight_smile: You want this to surface, but what if you also had other different documents with “commands” and you wouldn’t want documents with “/commands” to show in this case?

One trick you can use is to have keywords in your post:

<small>Keywords: commands</small>

1 Like

Oh I do agree it’s complicated! While /commands is an example, I have probably over 100 commands documented. So while using keywords could be an alternative, it’s not ideal.

If the word is found somewhere, it should pop in search, that is my understanding. For example:

/testcommand > query: testcommand > :no_entry_sign:

betacommand! > query: betacommand > :white_check_mark:

!betacommand > query: betacommand > :white_check_mark:

What makes the / different vs. ! here?

This is due to the way we index data:

“test /command” → “‘/command’:11 ‘test’:8A,10 ‘titl’:4A ‘uncategor’:9B”
“test !command” → “‘command’:11 ‘test’:8A,10 ‘titl’:4A ‘uncategor’:9B”

Notice we lost the ! in second case. We decided against keeping ! I suspect the punctuation character is not considered relevant in search.

2 Likes

I see, imo / shouldn’t be relevant either? Not sure how indexing works, but a setting to change this would help me a lot.

I noticed “somequery” as part of an URL returns the result https://domain.com/somequery-article-today if this URL is somewhere on the forum. This is expected behaviour - I do not know how related these are, but found it interesting that in this case the / is not relevant.

Another thing I noticed after diving into this a little deeper: we have a slash seperated string: query1/query2.

query1 returns a result, query2 returns no results, would you say this is expected too, because that seems more like a bug if U ask me… :thinking:

1 Like

Bumping this as I still believe it affects search a lot… some if the annoyances I’ve been having lately:

Github links > username nor repo name is searchable…
X links > usernames are not searchable

There are plenty more examples, if you don’t rely on search a lot these things might go unnoticed, as it does not really affect what you see in search, but what you don’t see. We are not supposed to be constantly thinking about whether or not a topic needs a keyword for find-ability.

This goes especially for drafts/staff sections, where posts are simply not done yet, sometimes stay there for years, or communication is in shorter/internal format. This post would not be findable for the keywords staff and internal if I didn’t add this… because Discourse simply decided they are not relevant? Why?

I can hardly agree that this is not a bug, rather a very uncommon approach for a search index decision.

3 Likes