• Dev
  • Search improvement plans

+1 regarding a better search.

A user on my forum complained about how if he opens a discussion with hundreds of posts, he cannot use the browser text search because Flarum doesn't preload the entire discussion, but at the same time the global Flarum search is very poor and so it's pretty difficult to find something on the forum and Google hasn't yet indexed our forum well enough... IMO a brand new embedded Flarum search engine is an absolute must for next versions.

Implementation with algolia or any other search would be nice avoids unnecessary load on server.

matteocontrini This one is a bit complicated. The changes I hope to include will make it trivial to add backend support for searching posts in a discussion. However, the search engine shipped with Flarum by default will still be MySQL FullText-based, so I'm not sure we can directly expect accuracy to increase.

However, if we add better support for search drivers, it will be easier to develop solutions like the ElasticSearch extension by Blomstra, and fall back to Flarum's default search for unsupported models.

    askvortsov great, thanks. In my case I think accuracy is a secondary problem. The problem currently is that the search feature only searches discussions, so if there's a discussion with 100 occurrences of a term (even with an exact match, or whatever MySQL is capable of doing) it will show just one result. This makes it very hard to find things that are within discussions. So the feature to search posts within discussions (and hopefully globally) would still be a huge improvement 🙂

    Regarding search, yes, the results just return a link to a discussion. On some of the oldest forum softwares one will get a list of all the posts that contain the matches. On Flarum the things are further complicated by the fact not all posts are loaded when a discussion is open and so it becomes hard to just use the browser search. Something needs to be improved but I don't know what. One solution would be to provide a contextual search, so that when you have an open discussion, then the search field would search within that discussion and will jump between posts or something. Another solution would be for the global search to return all single posts that match the term, not just the entire discussion. Would also be great if the term is highlighted when a discussion is open from a search.

    Search within a discussion is so easy, it's a solved problem, every browser could do that — if only there was a way to load all the discussion! But because of dynamic loading you have to reinvent the wheel…

    askvortsov Maybe I shouldn’t continue this discussion here. But, I’m sincerely curious. How did old PHP forum softwares do it? And, do we not try the older ways because they don’t scale well? Too much load on the server?

    I have no idea what I’m talking about to be honest. I just know years ago, I could search forums fairly in depth.

    Does Flarum try too hard to be super scalable or good for huge sites right out of the box? Maybe Flarum should have a really good search out of the box (without the need for third party or other things small sites don’t have or can’t pay for) even if it is too slow for large sites? Let the large sites hire a developer. 🙂

    I guess this goes against the Flarum way so to speak? The idea of Flarum is to be as modern as possible and ready for large sites?

    Just curious. I’m actually cool with the search as-is for my little forums. 😎

      010101 my 2 cents: traditional forum platforms usually have threads organized in pages, so you can't use "Ctrl+F" there as well. Most platforms though have a much more advanced search where you can usually choose:

      • whether to look for discussions or messages
      • whether to look only in titles
      • filter by author
      • filter by date range
      • filter by "categories"

      (This is true for XenForo and vBulletin for example, checked now.)

      Regarding performance: I know those platform allow setting a limit of searches, so it often happens that when you try to run a second search you're told that you need to wait 30 seconds, for example. Personally I don't think this is an issue, I can scale my forum if needed, I would prefer to have the features in the first place.

      P.S. sorry if we're going off topic

      7 days later

      Any additional thoughts from the development team on this? Although, I know search has been talked to death. I'm just curious to hear professional opinions around: why not just do a better (even if old school) PHP search system? And large sites, if that doesn't scale, can implement their own quicker or third party search solutions?

      Also, why can't you type in a keyword and press enter anymore? I think in early versions of Flarum you could. Now, if you type in a keyword and press enter it's hard to say what you'll get. To actually get a list of search results you have to click on "search all discussions." Is that not unintuitive to the average Internet user? Should be opposite. Press enter and you see search results. Click something extra if you instead want a "I Feel Lucky" type search.

        010101 To actually get a list of search results you have to click on "search all discussions."

        I spent a lot of time on this a few weeks ago, and was not able to find where the issue is. I hope someone can find which part of the code is causing the wrong default selection in dropdown, it's indeed very annoying. It's definitely not intentional, and I can't find what is wrong.

        010101 Also, why can't you type in a keyword and press enter anymore? I think in early versions of Flarum you could. Now, if you type in a keyword and press enter it's hard to say what you'll get. To actually get a list of search results you have to click on "search all discussions." Is that not unintuitive to the average Internet user? Should be opposite. Press enter and you see search results. Click something extra if you instead want a "I Feel Lucky" type search.

        Yes, agree with this.
        And other some problem.
        In mobile navigator on small screen when you go to menu/search and click to input data, appear the virtual keyboard in screen and hidden the search result. Because no working enter key need to hide the keyboard to view the search data.

        3 months later

        +1 for more/advanced search options.

        The number one thing we miss is Search inside a topic: some topics can be quite large on our forum, because not all posts loaded it sometimes is hard to search if certain things are already discussed or posted, so a search inside a topic would be really usefull.

        Tags search is already in 1.3 i see, so after we upgrade that should be sorted.

        But it would be nice to also have some additional parameters, like date/time ranges to search in, or posts from a specific user etc.

        • Specify date ranges in a search
        • TB54 replied to this.

          Powermage The number one thing we miss is Search inside a topic

          +1, that would be the very first thing to improve on flarum for me, the only real big issue. I don't really have this problem on my young forum, on which topics are pretty short, but I encounter it each single time i want to ask something on flarum's one: extensions's topics are often 200-300 messages long, and there is no way to know if the subject or question has already been discussed. In a milder way, same problem when searching in the messages of someone's profile (including your own, when you want to find quickly a topic you paticipated in while having forget its title).

          And yes, I like the simple search of flarum, but a complementary advanced search option (like searching in title or messages, searching only in the messages of one user...) would be really nice.