Search problems

I’m having difficulty with the search function when I look for sutta labels.

I get results from searches like:
mn1
but not from
sn12.15
though
bhumija
does give what I’m searching for:
SN12.25 Bhumija. Discussion from Dhamma Wheel

This is indeed odd, the IDs sometimes return positive results, other times not. Even stranger, they sometimes show results, then the results disappear and it says “No results”. Obviously there’s a bug somewhere, @blake can you look at this?

Clearly discourse search doesn’t like periods in the query terms. Unfortunately hacking discourse’s search is not easy. I might be able to monkey patch it from a plugin, although how easy that would be depends somewhat on how much is postgresql’s behavior. It might be fixable but no promises.

1 Like

Yes, I encountered the same problem too. It would be nice if searches with periods were possible as I imagine one of the main uses of the search is to look for discussions on certain suttas.

A related idea: perhaps when you search on Discourse for either ‘MN20’ or ‘MN 20’ the results for the other could also appear in the drop down list.
It’s great that the Discuss and Discover list already collects references using both the spaced and the non spaced format.

Edit:
Oh, and another idea for the search. At the moment searching for ‘Mahamangala’ doesn’t turn up posts including ‘Mahāmaṅgala’ with diacritical marks, and vice versa. I don’t know how hard this would be to fix.

I saw a thread on meta.discourse.org talking about difficulty searching Chinese. Here’s some Chinese for the purpose of testing:
佛說中阿含經, 佛说中阿含经。 一時佛遊舍衛國在勝林給孤獨園。

Edit #2:
Yes, the search here seems to have the same problem (only kewords adjacent to punctuation can be searched) as described in this thread on meta.discourse.org .
https://meta.discourse.org/t/chinese-search-issues/13287/2
Later on in the thread they seem to solve this problem. I guess this is something to think about if you consider having different language versions of Discourse.

These should give the same results, but we haven’t tuned the search engine fully here on Discourse yet. It’s prudent for us to leave this for now, as Discourse may adopt a more sophisticated search engine in future, or else we may apply the search engine we use on SuttaCentral itself.

To clarify what Blake said earlier, Discourse uses Postgresql search, while SuttaCentral uses the more full-featured and sophisticated elasticsearch. Ideally we would unify the search, but it would be a lot of work to do this, and the native search on Discourse is pretty good in most cases. So I’m afraid that these enhancements to search will have to wait for the platform to mature a little.